firelior Posted September 22, 2006 Share Posted September 22, 2006 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 outif(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!! Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted September 23, 2006 Share Posted September 23, 2006 just expire the cookie. for fun, you can remove its value, too.@setcookie("username", "", 1); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.