Jump to content

Sessions


user4fun

Recommended Posts

everytime I raed an article about sessions, I read it line by lne until I understanded as then at the end it says, this is no longer valid, do not use???session_register is deprecated$_SESSION['yadayada'] = "something I am storing"; is also no longer functional!!!!!!What is it that does work, How can I start a session and store the $myusername and $mypassword variables??

Link to comment
Share on other sites

page1.php

some stuffif($count==1){session_start();$_SESSION['accountname'] = '$myusername';header("location:page2.php");}else{echo "Wrong Username or Password";}

page2.php

<? $myusername= $_SESSION['accountname'];echo "Hello ". $myusername; ?>

The output is onlyHelloWhat am i doing wrong?

Link to comment
Share on other sites

The session_register() function is deprecated. Most other sessions functionality works fine. Most applications only ever need the session_start() function and the $_SESSION array.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...