Why dosen't this session work?
login.php:
------------start of file------------------
<?
if ((!$username) && (!$password)) login_form($username, $err_msg);
elseif(($username) && (!$password)) login_form($username, "Missing password!"
else pass_check($username, $password);
function login_form($username, $err_msg) {
?>
<form action="<? $php_self ?>" method=post>
<table boder=0 cellspacing=0 cellpadding=1>
<tr><td bgcolor=#000000><table border=0 cellspacing=0 cellpadding=2 bgcolor=#ffffff>
<tr><td colspan=2> Login</td></tr>
<tr><td colspan=2><font color=red><? echo $err_msg ?></font></td></tr>
<tr><td>User Name: </td><td><input type=text size=20 name=username value=<? echo $username ?>></td></tr>
<tr><td>Password: </td><td><input type=pass size=20 name=password> <font size=2>Forgot password?</font></td></tr>
<tr><td></td><td> Remember me</td></tr>
<tr><td colspan=2><font size=2>Not yet a member? register HERE</font></td></tr>
<tr><td colspan=2 align=right><input type=submit value=Login></td></tr>
</table></td></tr>
</table>
</form>
<?
}
function pass_check($username, $password) {
include("config.php"
$dbconn = mysql_connect("$db_host", "$db_user", "$db_pass"
$result = mysql_select_db("$db_name", $dbconn);
if ( $result == false )
{
echo mysql_error();
} else {
$sql = "SELECT username, password, on_hold, id FROM accounts WHERE username='$username'";
$result = mysql_query( $sql );
if ( $result != false )
{
$data = mysql_fetch_assoc( $result );
if (!$data['username']) {
login_form($username,"The username <b>$username</b> is not registred!"
}
else {
if (!$data['on_hold']) {
if ($password == $data['password']) {
session_start();
session_unset();
session_register("TesT"
$TesT = "100% working - JiPPii!!";
echo "Password accepted<br>Logging you in!";
?>
<a href='manager.php'>manager</A>
<?
//header("location: manager.php"
}
else {
login_form($username,"Incorrect password!"
}
}
else {
login_form($username,"You cannot login to <b>$username</b> because the account is<br>set on hold. Contact the webmaster for more help!"
}
}
} else {
echo mysql_error();
}
}
}
?>
-------------end of file-----------
manager.php:
-------------start of file---------
<?
session_start();
echo $TesT;
?>
--------------end of file---------- __________________
Visit my homepage
.: Game universE :.
login.php:
------------start of file------------------
<?
if ((!$username) && (!$password)) login_form($username, $err_msg);
elseif(($username) && (!$password)) login_form($username, "Missing password!"
else pass_check($username, $password);
function login_form($username, $err_msg) {
?>
<form action="<? $php_self ?>" method=post>
<table boder=0 cellspacing=0 cellpadding=1>
<tr><td bgcolor=#000000><table border=0 cellspacing=0 cellpadding=2 bgcolor=#ffffff>
<tr><td colspan=2> Login</td></tr>
<tr><td colspan=2><font color=red><? echo $err_msg ?></font></td></tr>
<tr><td>User Name: </td><td><input type=text size=20 name=username value=<? echo $username ?>></td></tr>
<tr><td>Password: </td><td><input type=pass size=20 name=password> <font size=2>Forgot password?</font></td></tr>
<tr><td></td><td> Remember me</td></tr>
<tr><td colspan=2><font size=2>Not yet a member? register HERE</font></td></tr>
<tr><td colspan=2 align=right><input type=submit value=Login></td></tr>
</table></td></tr>
</table>
</form>
<?
}
function pass_check($username, $password) {
include("config.php"
$dbconn = mysql_connect("$db_host", "$db_user", "$db_pass"
$result = mysql_select_db("$db_name", $dbconn);
if ( $result == false )
{
echo mysql_error();
} else {
$sql = "SELECT username, password, on_hold, id FROM accounts WHERE username='$username'";
$result = mysql_query( $sql );
if ( $result != false )
{
$data = mysql_fetch_assoc( $result );
if (!$data['username']) {
login_form($username,"The username <b>$username</b> is not registred!"
}
else {
if (!$data['on_hold']) {
if ($password == $data['password']) {
session_start();
session_unset();
session_register("TesT"
$TesT = "100% working - JiPPii!!";
echo "Password accepted<br>Logging you in!";
?>
<a href='manager.php'>manager</A>
<?
//header("location: manager.php"
}
else {
login_form($username,"Incorrect password!"
}
}
else {
login_form($username,"You cannot login to <b>$username</b> because the account is<br>set on hold. Contact the webmaster for more help!"
}
}
} else {
echo mysql_error();
}
}
}
?>
-------------end of file-----------
manager.php:
-------------start of file---------
<?
session_start();
echo $TesT;
?>
--------------end of file---------- __________________
Visit my homepage
.: Game universE :.