I have a login page
username: g
password: g
but once I login, how do I refresh only the header of the page so it welcomes the user right off the bat, instead of welcoming the user when they go to another page?

It worked the way you want for me when I logged in.


should I follow

I tried to follow that tutorial and it seems like its not refreshing, but I the login/register thing is there so I guess the thing is just not reading the session variables, isnt it suposed to refresh after 5 seconds?
I set three session variables being set upon sucessful login.

I am not exactly sure which header you mean…

Sorry, I’m pretty bad at explaining things…
Here what I’m saying when I login
u: g
x: g
I get the sucessful login thing, so this is run

echo "<h3>Welcome, {$user}</h3>";
echo "<p align=\\"center\\">Thank you for Logging in.  You may now <a href=\\"providers/become_a_provider.php\\">sign up</a> to become a provider, or <a href=\\"reviews/submit_a_review.php\\">review</a>";
echo " a provider</p><p align=\\"center\\"><img src=\\"images/success.jpg\\" class=\\"result\\"></p>";
$_SESSION['logged'] = 1;
$_SESSION['user'] = $user;
$_SESSION['id'] = $info['id'];

but In my <header>, I have,

<script src="/masterasp/js/ajax.js"></script>
<script type="text/javascript"><!--
// --></script>
<div id="top"></div>

<h1><a href="/masterasp/">MasterASP</a></h1>
<li><a href="/masterasp/">Home</a></li>
<li><a href="/masterasp/providers/">Providers</a></li>
<li><a href="/masterasp/reviews">Reviews</a></li>
<li><a href="/masterasp/forum/">Community</a></li>
<li><a href="/masterasp/faq.php">FAQ</a></li>
<li><a href="/masterasp/contact.php">Contact</a></li>

Im trying to refresh the top div (using the ajax thing) and in it is

if($_SESSION['logged'] == 1){
    echo "<span>Welcome ".$_SESSION["user"]."</span>"; 
    echo "<ul>";
    echo "<li><a href=\\"/masterasp/logout.php\\">Logout</a></li>";
    echo "</ul>";
} else {  
    echo "<ul>";
    echo "<li><a href=\\"/masterasp/login.php\\">Login</a></li>";
    echo "<li><a href=\\"/masterasp/register.php\\">Register</a></li>";
    echo "</ul>";

but it looks like that if statement never evaluates to true, and I dont see why not

I see absolutly nothing wrong with that code. I am just as stumped as you…

Are you calling session_start() at the top of each page?

Yes, I have session_start(): on the top of each page. I tried to do a little debugging.
so I login at
(I added a time thing in the <div id=“top”> which seems to be updated every 5 seconds so I gather it should work).

I also added
after logging in so you can see my three session variables, but I have
in the refreshing div, and the three variables doesnt seem to be transferred after the refresh.

Does this help at all?