need help with this php login form
Posted: Fri Jan 14, 2005 4:05 pm
this is what i have..
----------
form.php
----------
----------
process.php
----------
----------
admin.php
----------
----------
logout.php
----------
-------
this section seems to be the problem
under the admin.php
i found out that all the files work besides this one..
if i remove the "!" before isset everything works fine.. however i can directly type in http://www.kurbot.com/login/admin.php.. it doesnt verify a session/user
but when i put this
back in it just keeps redireccting me to the login page saying i provided a false username / password..
please help
feyd | please use some formatting.
----------
form.php
----------
Code: Select all
<form method="post" name="login" action="process.php">
<p> Username :
<input type="text" name="username" />
</p>
<p>Password : <input type="password" name="password" /></p>
<p><input type="submit" name="submit" value="Submit" /></p>
</form>
<?php
if (isset($_GETї'error'])) {
echo 'Invalid login data supplied. Please try again.';
}
?>process.php
----------
Code: Select all
<?php
session_start();
$dbHost = "not telling";
$dbUser = "not telling";
$dbPass = "not telling";
$dbname = "not telling";
$username = $_POSTї'username'];
$password = $_POSTї'password'];
$db = mysql_connect($dbHost,$dbUser,$dbPass);
mysql_select_db($dbname,$db);
$query = "SELECT * FROM login WHERE user = '$username' AND pass = '$password'";
$results = mysql_query($query, $db);
if(mysql_num_rows($results)) {
$_SESSIONї'loggedin'] = 1;
header('Location: http://kurbot.com/login/admin.php');
exit();
} else {
header('Location: http://kurbot.com/login/form.php?error=1');
exit();
}
?>admin.php
----------
Code: Select all
<?php
session_start();
if(!isset($_SESSIONї'loggedin'])) {
header('Location: http://kurbot.com/login/form.php?error=1');
exit();
}
?>
Welcome to the admin section. <a href="logout.php">Log out</a>.----------
logout.php
----------
Code: Select all
<?php
session_start();
session_unset();
session_destroy();
header('Location: http://kurbot.com/login/form.php');
exit();
?>this section seems to be the problem
under the admin.php
Code: Select all
<?php
session_start();
if(!isset($_SESSIONї'loggedin'])) {
header('Location: http://kurbot.com/login/form.php?error=1');
exit();
}
?>
Welcome to the admin section. <a href="logout.php">Log out</a>.if i remove the "!" before isset everything works fine.. however i can directly type in http://www.kurbot.com/login/admin.php.. it doesnt verify a session/user
but when i put this
Code: Select all
if(!isset($_SESSIONї'loggedin'])) {
header('Location: http://kurbot.com/login/form.php?error=1');
exit();
}please help
feyd | please use some formatting.