943,721 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 860
  • PHP RSS
Apr 2nd, 2008
0

problem in header include

Expand Post »
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['un']))
  4. {
  5. header('Location: web_login.html');
  6. exit();
  7. }
  8. else
  9. {
  10. ?>
  11. <html>
  12. <body>
  13. <?php
  14. print "<table align='center'><tr><td>Thank u</td></tr>";
  15.  
  16. echo $_SESSION['un'];
  17.  
  18. print "<tr><td><a href='http://www.examples.com/fram.php'>View Order</a></td></tr>";
  19.  
  20. print "<tr><ta><a href='http://www.examples.com/web_job.php'>Search </a></td></tr>";
  21.  
  22. print "</table>";
  23. }
  24. ?>
  25. </body>
  26. </html>



when i execute this code even though my $_SESSION['un'] is present in the database it's showing the web_login page.else is not working.any error in header include code.
Similar Threads
Reputation Points: 3
Solved Threads: 2
Junior Poster
kings is offline Offline
107 posts
since Nov 2007
Apr 2nd, 2008
0

Re: problem in header include

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

May be it will work,,

Jino.
Reputation Points: 10
Solved Threads: 10
Junior Poster
jino is offline Offline
114 posts
since Feb 2008
Apr 2nd, 2008
0

Re: problem in header include

thank u for ur reply.still getting that same problem.
Reputation Points: 3
Solved Threads: 2
Junior Poster
kings is offline Offline
107 posts
since Nov 2007
Apr 2nd, 2008
0

Re: problem in header include

Right after session_start, print $_SESSION['un'] and tell us what it prints.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Apr 2nd, 2008
0

Re: problem in header include

the session value is not getting printed.
Reputation Points: 3
Solved Threads: 2
Junior Poster
kings is offline Offline
107 posts
since Nov 2007
Apr 2nd, 2008
0

Re: problem in header include

then it simply means that $_SESSION['un'] is not existing.Where does this session comes from anyway?
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Apr 2nd, 2008
0

Re: problem in header include

Add whatever value to $_SESSION['un'] and then check again. I guess it has to have username ? When the user logs in, assign the username to $_SESSION['un'].
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Apr 2nd, 2008
0

Re: problem in header include

thanks. i got it....
Reputation Points: 3
Solved Threads: 2
Junior Poster
kings is offline Offline
107 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: list box
Next Thread in PHP Forum Timeline: online music application





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC