melewatkan variable dengan session

Happy Coding
<?php
// file name : website.php
// description : melewatkan variable dengan session
session_start();
$_SESSION['username']='kenzu';
$_SESSION['authuser']=1;
?>
<html>
<head>
<title>my effort is coding</title>
</head>
<body>
<?php
$mymovie=urlencode('life is simple');
echo "<a href="myweb.php?favmovie=$mymovie">";
echo "click here to see information about my favorite movie";
echo "</a>"
?>
</body>
</html>


And then..

<?php
// file name : myweb.php
// description : melewatkan variable melewatkan variable dengan session
session_start();
if($_SESSION['authuser']!=1){
echo "sorry guys u can't access this page<br>";
}
?>
<html>
<head>
<title>my movie - <?php echo $_GET['favmovie']; ?></title>
</head>
<body>
<?php
echo "welcome to our site : ";
echo $_SESSION['username']."<br>";
echo "my favorite movies is "";
echo $_GET['favmovie'].""";
?>
</body>
</html>

Related Posts

Posting Komentar