^ I'm having trouble following...when I log into my_index.php it says: You are logged in as Paul (ID: 2) Logout When I check the session it says: Array ( [auth] => Paul [ID] => 2 )
When I added this code:
if (!defined('INCLUDED776')) die ('Fatal error.');
$cookieexptime=time()+$cookie_expires; @session_start();
function user_logged_in() {
$c=array('', '');
if(isset($GLOBALS['cook']) and trim($GLOBALS['cook'])!='') { $c=explode('|',$GLOBALS['cook']); if($row=db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'], $GLOBALS['dbUserSheme']['username'][1], '=', $c[0], 1)){ $c=array($c[0], $row[0]); echo $username; } } else $c=getMyCookie(); $username=$c[0];
if($username=='') { $returned=FALSE; return; }
echo $username;
if(isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase']) { $caseComp1=$GLOBALS['caseComp'].'('; $caseComp2=')'; $usernameSql=strtolower($username); } else { $caseComp1=''; $caseComp2=''; $usernameSql=$username; }
if($row=db_simpleSelect(0,$GLOBALS['Tu'],$GLOBALS['dbUserId'].','. $GLOBALS['dbUserSheme']['user_sorttopics'][1].','. $GLOBALS['dbUserSheme']['language'][1].','. $GLOBALS['dbUserAct'] .','. $GLOBALS['dbUserSheme']['user_password'][1] .', '.$GLOBALS['dbUserSheme']['username'][1].', '.$GLOBALS['dbUserSheme']['num_posts'][1],$caseComp1.$GLOBALS['dbUserSheme']['username'][1].$caseComp2,'=',$usernameSql, '',1)){
if($row[0]==$c[1]){ $returned=TRUE; echo $username; $GLOBALS['user_sort']=$row[1]; if($row[0]==1) { $GLOBALS['logged_admin']=1; $GLOBALS['logged_user']=0; } else { $GLOBALS['logged_admin']=0; $GLOBALS['logged_user']=1; }
$GLOBALS['langu']=$row[2]; $GLOBALS['user_activity']=$row[3]; $username=$row[5]; $GLOBALS['user_num_posts']=$row[6];
} else{ /* Preventing hijack */ $username=''; echo $username; $returned=FALSE; }
} else{ $returned=FALSE; }
return $returned; }
function setMyCookie($userName,$userPass,$userExpTime,$encodePass=TRUE){
if($row=db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'], $GLOBALS['dbUserSheme']['username'][1], '=', $userName, 1)){ $_SESSION['auth']=$userName; $_SESSION['ID']=$row[0]; echo $username; }
}
function getMyCookie(){ if(isset($_SESSION['auth']) and isset($_SESSION['ID'])) { $cookievalue=array($_SESSION['auth'], $_SESSION['ID']); } else $cookievalue=array('',''); return $cookievalue; }
function deleteMyCookie(){ unset($_SESSION['auth']); unset($_SESSION['ID']); }
function writeUserPwd($pwd){ return $pwd; }
?>
^Once again copy and pasted from the synchronization tutorial
It doesn't display username nor are they logged in. I know you said the tutorial code is different, but can you explain more and maybe how I can change it to fit my forum. Also when I manually log in it says: Sorry, it seems like an intrusion attempt or your server doesn't support HTTP referrers! |