Jump to content

Archived

This topic is now archived and is closed to further replies.

firelior

session and cookie-login-help(should be simple)

Recommended Posts

Hi,
I got this code:
[code]
<?
session_start();
#########################
##Here it always exits!##
#########################
if(isset($_COOKIE['username']) || isset($_COOKIE['password'])){
exit(<p><a href="login.php?log=1">logout</a>);
}
//here it should log out
if(isset($_GET['log'])==1){
setcookie ("username", "admin", time() - 4000);
setcookie ("password", "admin", time() - 4000);
}

if(isset($_POST['username']) || isset($_POST['password']))
{

if($_POST['username']==$Ausername || $_POST['username']==$Apassword)
{
if(isset($_POST['remember']))
{
@setcookie("username", $_POST['username'], time() + 3600);
@setcookie("password", $_POST['password'], time() + 3600);
$_SESSION['username']=$Ausername;
$_SESSION['password']=$Apassword;
}
else
{
@setcookie('username', $_POST['username']);
@setcookie('password', $_POST['password']);
$_SESSION['username']=$Ausername;
$_SESSION['password']=$Apassword;
}

}
else die($lang->invalidup.'<p><a href="login.php">Go Back</a>');
}

else
{
echo "

<form method='post' action='login.php'>
Username: <input type='text' name='username'>
<br>Password: <input type='password' name='password'>
<br><input type='checkbox' name='remember'>Remember me on this computer
<p><input class='button' type='submit' value='Login'>
</form>

";
}

?>[/code]

Now, My problem is that it always exists in the line I told you above..
I cant destroy the cookie.
Please help me destroy the cookie
thanks!!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.