
May 12th, 2008, 03:03 PM
|
 |
System.out.println("eh?");
|
|
Join Date: Feb 2004
Location: Derbyshire
|
|
Quote: | Originally Posted by GameYin He said he did that. Post the code for the page that is "broken" and the page where session is set. The original one. |
Hi
Thanks for the input. I have included the code below, I do not know how much of a use it will be.
PHP Code:
Original
- PHP Code |
|
|
|
function isCron() { if(isset($_SERVER['SHELL']) && $_SERVER["SHELL"]== "/bin/sh") return true; } if(!isCron()) { date_default_timezone_set('Europe/London'); } date_default_timezone_set('Europe/London'); define("SITE_GENERIC_ERROR_MESSAGE", WEBSITE. " error - please go back and try again."); ini_set('include_path', '.:'.PEAR_ROOT. ':'.OBJECT_ROOT. ':'.SCAFFOLD_ROOT. ':'.UTIL_ROOT. ':'.TYPES_ROOT. ':'.SMARTY_ROOT. ':'.IN TERFACE_ROOT. ''); require_once ('ut_global_functions.inc'); require_once ('interface_object.inc'); require_once ('object.inc'); require_once ('type.inc'); require_once ('ut_page.inc');
This function ( login() ) is caled once POST data has been verified, this executes successfully and then calls onLogin.
PHP Code:
Original
- PHP Code |
|
|
|
public function login() { if($this->load($this->login_admin_username,'username')) { if($this-> get('lock_until') > time()) return '<span class="error">You have failed to login in too many times, your account has been automatically locked for '.LOCKOUT_MINS.'</span>'; else if(trim($this-> login_admin_password) != $this-> get('password')) { $fails = $this->get("failed_logins"); $fails++; $this->set("failed_logins", $fails); if($fails >= FAILED_LOGIN_LIMIT) $this-> set("lock_until", time()+ (60*LOCKOUT_MINS )); $this->save(); return '<p class="error">The details you entered were incorrect.</p>'; } else if(trim($this-> login_admin_password) == $this-> get('password')) if($this->onLogin()) return '<span class="success">Your login was successful</span><meta http-equiv="refresh" content="0;url='.LIVE_ADMIN_URL.'">'; else return '<span class="error">An internal error occured while processing your login, please try again.</span>'; else return '<span class="error">An internal error occured while processing your login, please try again.</span>'; } else return '<span class="error">The details you entered were incorrect.</span>'; }
Line 23 above returns true and the page is redirected, once the page is redirected and I var_dump($_SESSION) everything is set. If I then refresh or go to another admin page the sessions have gone completely. onLogin function below is where the sessions are set.
PHP Code:
Original
- PHP Code |
|
|
|
private function onLogin($isAuto = false) { $_SESSION['password'] = $this->login_admin_password; $_SESSION['username'] = $this->login_admin_username; $_SESSION['logged_in_at'] = time(); $logins = $this->get('logins'); $logins++; if(!$isAuto) $this->set("logins",$logins); $this->set("failed_logins",0); $this->set("lock_until",0); $this->save(); return true; }
Thanks for your time and efforts.
Jake
|