Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Sessions make a page go... White?

session

  • Please log in to reply
3 replies to this topic

#1 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 25 June 2011 - 07:55 PM

EDIT: Ok this is a standard mistake, its fixed now, I wonder who can spot it first?
Hello,
I have been making a site, its pretty darn awesome if you ask me (Normally I fail at visual design). Anyway its private so only my friends can access it- I use sessions to store the login data as the user moves around my site. If I visit the homepage I get redirected to my login page, then once I have logged in I get this:

A white screen!
All I know is that commenting and uncommenting the page that handles checking the user is logged in (and also commenting/uncommenting a small script that sets the user id to 1, so the site can still function without a proper login when I'm debugging) causes this white page! I have found nothing in my error logs (I will try to find some others as these only seem to have 404s and such).

Here is the login handler.
I won't upload the actual page for the sake of all our sanity but I do know it commits suicide if MySQL queries that involve the user ID fail...
<?php
session_start();
function reqLogin() {
header('Location: /login.php');
}
if(isset($_SESSION['login'])) {
if($_SESSION['login'] == true) {
$userID == $_SESSION['id'];
} else {
reqLogin();
}
} else {
reqLogin();
}
?>

  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#2 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 25 June 2011 - 08:06 PM

May you try turning errors to maximum and reproduce the problem?

The instructions are in our FAQ:
(http://forum.codecal...-questions.html # 1)

Also try to echo each step to see what is successful and where.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#3 njr1489

njr1489

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 69 posts

Posted 26 June 2011 - 12:27 PM

Have you checked your PHP error log? Sometimes it will show errors your pages won't show.
  • 0

#4 bbqroast

bbqroast

    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 26 June 2011 - 04:11 PM

Fixed, completely forgot how but yeah I fixed it :D
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download