Jump to content

Sessions make a page go... White?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
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();

	}

?>

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

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
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.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
Have you checked your PHP error log? Sometimes it will show errors your pages won't show.

#4
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Fixed, completely forgot how but yeah I fixed it :D
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).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users