<?php
// file name : website.php
// description : melewatkan variable dengan cookie
setcookie('username','kenzu',time()+60);
session_start();
$_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 dengan cookie
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 $_COOKIE['username']."<br>";
echo "my favorite movies is "";
echo $_GET['favmovie'].""";
?>
</body>
</html>
Posting Komentar
Posting Komentar