<?php
# -----------------------------------------------------------------------------
#
# Contains the user login for TVEz
#
# -----------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#
# This file is part of TVEz (tvez.sourceforge.net).
#
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------------
#
# Created on 12/12/2003 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/02/03 00:10:20 $
# $Revision: 1.6 $
# $Author: eheim $
#
# -----------------------------------------------------------------------------
if (isset($_REQUEST['action']) && $_REQUEST['action'] == "login") {
list($num,$user) = get_user_by_name_and_passwd($_REQUEST['username'],$_REQUEST['passwd']);
if ($num) {
echo '<div class="usermsg">'.localize_string("You are being logged in").'</div>';
flush();
$_SESSION['tvezUser'] = $user[0]['username'];
$_SESSION['tvezAccess'] = $user[0]['access'];
$_SESSION['tvezFirstname'] = $user[0]['firstname'];
$_SESSION['tvezLastname'] = $user[0]['lastname'];
list($page,$query) = split("\?",$_REQUEST['referer'],2);
sleep(2);
echo '
<script type="text/javascript">
top.location.replace("index.php?'.$query.'");
</script>
</body>
</html>
';
exit;
}
else {
echo '<div class="usermsg">'.localize_string("The user could not be authentified").'</div>';
}
}
echo '
<script language="javascript">
function encrypt_passwd(form) {
form.passwd.value = hex_md5(form.passwd.value);
return true;
}
</script>
<form method="POST" action="tvez.php">
<input type="hidden" name="action" value="login">
<input type="hidden" name="content" value="user">
<input type="hidden" name="page" value="login">
<input type="hidden" name="referer" value="'.$_SERVER['HTTP_REFERER'].'">
<br><br>
<table cellpadding="5" cellspacing="1" align="center" class="user">
<tr class="usertitle">
<td colspan="2" align="center">'.localize_string("Login").'</td>
</tr>
<tr>
<td align="right">'.localize_string("Username").':</td>
<td><input type="text" name="username" size="15"></td>
</tr>
<tr>
<td align="right">'.localize_string("Password").':</td>
<td><input type="password" name="passwd" size="15"></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="'.localize_string("Login").'" onclick="javascript: return encrypt_passwd(this.form);"></td>
</tr>
</table>
</form>
';
?>