Quick Question on Sessions



I would like to do the following (But it's NOT working for the
select_zip.php line below):

<?php
if(!$WALM->checkUserSession()){
?>
<li><a href="register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
<?php
} else {
?>
<li>
<a href="select_zip.php?zip=<?php echo $user['zip']; ?>">Browse
Products</a></li>
<li><a href="logout.php">Logout</a></li>
<?php
}
?>

Here is checkUserSession() function:

function checkUserSession() {
if(isset($_SESSION['usalm_user']) && isset($_SESSION['usalm_pass']))
{
$sql = "SELECT * FROM customers WHERE email='" . $this->db->Scrub-
escape_string($_SESSION['usalm_user']) . "' AND password='" . $this-
db->Scrub->escape_string($_SESSION['usalm_pass']) . "'";
if($this->db->num_rows($this->db->query($sql)) > 0){
return true;
} else {
return false;
}
} else {
return false;
}
}

However I can't seem to figure out the right syntax for PHP to pull
from the person's zip code which is inside the MySQL DB and I declared
as $user['zip'] within my core includes file, so if anyone can help me
please let me know how am I going about this wrong, this seems to be
pretty basic, but I'm a bit lost here on how to pull from a logged in
session from the DB of his/her zip code. See all of the following code
to help better understand what I'm mean of the user's defined zip
that's within the DB:

echo "<p>";
if(!empty($user['organization'])) echo $user['organization'] .
"<br>";
echo $user['first_name'] . " " . $user['last_name'] . "<br>";
echo $user['address'] . "<br>";
if(!empty($user['address2'])) echo $user['address2'] . "<br>";
echo $user['city'] . ", " . $user['state'] . " " . $user['zip'];
echo "</p>";

Which you can see here I have the $user['zip'], and the link above I'm
trying to make it fill in the data per the user's zip code that's
inside his/her account, which is defined in the above.

As the string should work as such:

select_zip.php?zip=98101

As you see above, my code isn't working properly and is ONLY arraying
as such:

Any and all help is appreciated greatly, this is a simple fix, but
there is something for a beginner that I'm missing!!!
.



Relevant Pages

  • Re: Newbie PHP question: hiding code on server from View Source
    ... I never was able to figure out CGI on a remotely hosted web server the ... few times I tried, but PHP is working fine...at ... You can use it much like an "include" command to pull in PHP routines ...
    (comp.lang.php)
  • Re: PHP equivalent of perls HTML::TreeBuilder;
    ... So I need to pull out the navigation blocks and page display ... convenience in PHP? ... Once you have a DOMDocument object, you can even feed it to the SimpleXML functions and do cool stuff like this: ... // Fetch titles: ...
    (comp.lang.php)
  • Re: mySQL Query with varchar(5000) fields will not pull data from thesefields
    ... When run in mySQL console I can see it pull the data from the varcharok but when the same query is executed under PHP I cannot get any information from the varcharfields. ...
    (comp.lang.php)
  • Re: [PHP] Authentication
    ... Within PHP, is there a way to pull the name of the user that is currently ... I know with some of the _SERVER functions you can pull the IP of the machine ... had success employing it.... ...
    (php.general)
  • Re: [PHP] can a session be used in a query?
    ... I have the session working, and can echo it to see that .. ... in the query to pull only that users data I also on the login page where I ... the query UserName = $UserName I get an undefined variable error... ...
    (php.general)