热搜:NVER 

Lost session varible between pages,该怎么解决

2024-05-17 16:24:01
 Lost session varible between pages,该怎么解决

Lost session varible between pages
movie1.php
<?php session_start();
$_session['username']="Jhon";
$_session['authuser']=1;
?>


Find my favorite movie!


<?php
$myfavmovie=urlencode("transformers");
echo "";
echo "Click here to see information about my favorite movie!";
echo "
".$_session['username']; //ok, display Jhon



?>



moviesite.php
<?php session_start();
/*
if ($_session['authuser'] != 1){
echo $_session['authuser'];
echo "Sorry, but you don't have pemission to view the page, you loser!";
exit();
}
*/
?>


My movie site - <?php echo $_request['favmovie']; ?>


Welcome to our site, 
<?php echo $_session['username'] ?>! //doesn't work, display nothing,why?

My favorite movie is 
<?php echo $_request['favmovie'] ?>! //doesn't work, display nothing,why?


<?php $movierate=5; ?>
My movie rating for this movie is: 
<?php echo $movierate; ?>



//register_globles = OFF

------解决方案--------------------
$_SESSION大写