Jump to content

Basic Sessions?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
phpforfun

phpforfun

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,236 posts
Pretty basic, but for some reason im stuck. I cant get sessions to run.. I dont think. Or maybe I have a problem getting the set information.

Look at this..

http://analyzethathost.com/session.php

the EXACT code for that is this.

<?

session_start();

$username = $_SESSION['username'];

if(isset($username)){

	Echo $username;

} Else {

	if(isset($_GET['do'])){

		 session_register("username", JohnDoe);

		Echo 'session started! <a href="?">Click here to go home and view the name your session was started with</a>';

	} Else {

		Echo '<a href="?do=yes">click here to start session</a>';

	}

}

?>

I was told that is the correct code, and its the code I pretty much cut and pasted from the other music site I had a while back..

any ideas? Does it work for you guys?

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
PHP: session_register - Manual

Quote

If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.