xyn Posted March 28, 2008 Share Posted March 28, 2008 This isnt really a big issue but, i have a desktop application using flex, which submits login data to the server, if correct sets a cookie for 60 seconds, and returns the var to flex. but after 60 seconds the cookie isnt expired. my code: <? session_start(); require_once("connections/db_con.sql.php"); require_once("classes/functions.inc.php"); if(!$_SESSION['intranet_authorised']){ $error =0; if(!$_POST['username']) $error++; if(!$_POST['password']) $error++; $sql_check =mysql_query("select * from `intranet_accounts` where `account_email`='".secure($_POST['username'])."' and md5(`account_password`) ='".md5(secure($_POST['password']))."'"); if(!mysql_num_rows($sql_check)) $error++; if($error >=1){ print "&isValidLogin=0"; }else{ $data =mysql_fetch_assoc($sql_check); setcookie("intranet_dklogon","{$data['account_id']}:".md5($data['account_password']),time()+60); mysql_query("update `intranet_accounts` set `data_last_login`=now() where `account_id`='{$data['account_id']}'"); print "&isValidLogin=1"; } }else{ print "&isValidLogin=1"; } ?> Link to comment https://forums.phpfreaks.com/topic/98307-cookies-dont-expire/ Share on other sites More sharing options...
xyn Posted March 28, 2008 Author Share Posted March 28, 2008 It works, sorry. I just needed to clear the chaches and thoroughly test it afterwards. Link to comment https://forums.phpfreaks.com/topic/98307-cookies-dont-expire/#findComment-503044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.