html - Get current session info using separate linked php file -
these times select shows in file. . . .
function getuserfromemail($email,&$user_rec) { if(!$this->dblogin()) { $this->handleerror("database login failed!"); return false; } $email = $this->sanitizeforsql($email); $result = mysql_query("select * $this->tablename email='$email'",$this->connection); if(!$result || mysql_num_rows($result) <= 0) { $this->handleerror("there no user email: $email"); return false; } $user_rec = mysql_fetch_assoc($result); return true; }
and . . .
function checkloginindb($username,$password) { if(!$this->dblogin()) { $this->handleerror("database login failed!"); return false; } $username = $this->sanitizeforsql($username); $nresult = mysql_query("select * $this->tablename username = '$username'", $this->connection) or die(mysql_error()); // check result $no_of_rows = mysql_num_rows($nresult); if ($no_of_rows > 0) { $nresult = mysql_fetch_array($nresult); $salt = $nresult['salt']; $encrypted_password = $nresult['password']; $hash = $this->checkhashssha($salt, $password); } $qry = "select name, email $this->tablename username='$username' , password='$hash' , confirmcode='y'"; $result = mysql_query($qry,$this->connection); if(!$result || mysql_num_rows($result) <= 0) { $this->handleerror("error logging in. username or password not match"); return false; } $row = mysql_fetch_assoc($result); $_session['name_of_user'] = $row['name']; $_session['email_of_user'] = $row['email']; $_session['phone_of_user'] = isset($row['phone'])?$row['phone']:'phone not set'; return true; }
also, time $row shows well. functions being called other php file follows . . . .
<p id="mobilecheck" align="center"> willkommen züruck <? echo $fgmembersite->userfullname(); ?>! </br>
willkommen userphone(); ?>! willkommen züruck useremail(); ?>!
rick, i'll wite here understand better. debugging purposes next thing:
instead of
$_session['phone_of_user'] = $row['phone'];
put this:$_session['phone_of_user'] = $row; //this put entire array in variable
instead of:
<p id="mobilechiiieckby" align="center"> willkommen <? echo $fgmembersite->userphone(); ?>! </br>
write this:
<p id="mobilechiiieckby" align="center"><pre><?php print_r($_session['phone_of_user']); ?>!</pre></p>
these 2 simple modifications see what's inside $row variable. after see it's content can play it. let's continue discussion here, , i'll update answer new information.
later edit: update line:
$qry = "select name, email $this->tablename username='$username' , password='$hash' , confirmcode='y'";
with one:
$qry = "select name, email, phone $this->tablename username='$username' , password='$hash' , confirmcode='y'";
Comments
Post a Comment