Page 1 of 1

header not working properly is there any other way?

Posted: Mon Mar 10, 2008 2:23 pm
by pinjubp
i am new here
plz help me

Code: Select all

$GLOBALS["smarty"]->display('login.tpl');
 
 
 
if($GLOBALS["Get"]->val("submit")!=""){
    
        $admin = $GLOBALS["Get"]->val("admin");
        $password = $GLOBALS["Get"]->val("password");
        $p=md5($password);
        $db = new sqldb;
        $sql_query="SELECT * FROM admin WHERE user='$admin' AND PASSWORD ='$p' LIMIT 1";
        $value=$db->result($sql_query);
        
        $sn =new session;
        if($value['user']&&$value['password']){
        $sn->setSess('adminuser','yes');
        //echo $value['user'];
        header("Location: index.php?page=adminpage");
        
 
} 
    }
 

Re: header not working properly is there any other way?

Posted: Mon Mar 10, 2008 4:13 pm
by alex.barylski
Why is it not working?

Try an absolute path:

Code: Select all

header('Location: http://www.domain.com/index.html');

Re: header not working properly is there any other way?

Posted: Tue Mar 11, 2008 4:18 am
by anto91
pinjubp wrote:i am new here
plz help me

Code: Select all

$GLOBALS["smarty"]->display('login.tpl');
 
 
 
if($GLOBALS["Get"]->val("submit")!=""){
    
        $admin = $GLOBALS["Get"]->val("admin");
        $password = $GLOBALS["Get"]->val("password");
        $p=md5($password);
        $db = new sqldb;
        $sql_query="SELECT * FROM admin WHERE user='$admin' AND PASSWORD ='$p' LIMIT 1";
        $value=$db->result($sql_query);
        
        $sn =new session;
        if($value['user']&&$value['password']){
        $sn->setSess('adminuser','yes');
        //echo $value['user'];
        header("Location: index.php?page=adminpage");
        
 
} 
    }
 
The first row show to us is an output, do be able to uses headers after output you need to start your script with ob_start(); and preferably end with ob_end_flush();