FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP using Sessions





moejoe
Hi,

Is there a Sessions function that sends the session information throught other scripts.

For Example,

I have a Session_start() on my index page, and i want this session information to travel throught my navigation script.


Code:
<?php
session_start();
include('http://mysite.com/nav.php'); ?>


My Nav.php Script;
Code:

<?php
echo '<a href="LINK">
      LINK1</a>';

      if(isset($_SESSION['logged_in']) {
      echo 'EXTRA USER INFO';
} else {
echo 'Guest Info':
}

?>


However this "Session" does not seem to feed through..
How can i get it to work?

Thanks.
fromegame
Code:
<?php
session_start();
$_SESSION['logged_in'] = "true";
include('http://mysite.com/nav.php');
?>



Code:
<?php

echo '<a href="LINK">
      LINK1</a>';

      if(isset($_SESSION['logged_in']) {
      echo 'EXTRA USER INFO';
} else {
echo 'Guest Info':
}

?>
moejoe
Nope..
Still didn't Work..

Isn't there a session_is_registered() function that i could use or something similar?
hexkid
moejoe wrote:
Code:
<?php
session_start();
include('http://mysite.com/nav.php'); ?>
No, no, no! Don't include an external file. The way you are doing it you are including
Quote:
<a href="LINK">
LINK1</a>Guest Info

Try this instead
Code:
include '/home/moejoe/domains/mysite.com/nav.php';
or simply
Code:
include 'nav.php';
moejoe
I LOVE YOU HEXKID...

Have my children...
Laughing

Just Kiddin,
Thanks, you are the best!

You solved that problem, and another problem i was pulling my hair out with!! And no doubt, will help me with the development of my site.. Once again, your the best.
Related topics
Storing A Lot of Values Using Sessions
php sessions
Sessions
PHP Login Sessions & Security with Frihost
How To : Secure Your PHP Website
Tutorial: PHP Installed Modules Dynamic Reference Tool
INSTALL PHP
Validation help needed
PHP, where to write it?
FireFox and Cookies/Sessions
php/HTML pages question
WHat is the best PHP guidebook?
I need some help please!
Tracing an IP with PHP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.