<?php
session_start();
if(!isset($_SESSION['un']))
{
header('Location: web_login.html');
exit();
} 
else 
{
?>
<html>
<body>
<?php
        print "<table align='center'><tr><td>Thank u</td></tr>";

        echo $_SESSION['un'];

        print "<tr><td><a href='http://www.examples.com/fram.php'>View  Order</a></td></tr>";

        print "<tr><ta><a href='http://www.examples.com/web_job.php'>Search </a></td></tr>";

        print "</table>";
}
?>
</body>
</html>

when i execute this code even though my $_SESSION is present in the database it's showing the web_login page.else is not working.any error in header include code.

Recommended Answers

All 7 Replies

Use if(!session_is_registered('un')) instead of if(!isset($_SESSION))

May be it will work,,

Jino.

thank u for ur reply.still getting that same problem.

Right after session_start, print $_SESSION and tell us what it prints.

the session value is not getting printed.

then it simply means that $_SESSION is not existing.Where does this session comes from anyway?

Add whatever value to $_SESSION and then check again. I guess it has to have username ? When the user logs in, assign the username to $_SESSION.

thanks. i got it....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.