Add exams from exam58 to exam98
This commit is contained in:
7
exam73/Cookie.php
Normal file
7
exam73/Cookie.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
setcookie('username', 'nikola', time() + 1500);
|
||||
//ovako brisemo
|
||||
//setcookie('username', 'nikola', time()-1500);
|
||||
|
||||
?>
|
||||
14
exam73/Sessions.php
Normal file
14
exam73/Sessions.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if( isset($_SESSION['username']) && isset($_SESSION['age'])){
|
||||
echo ' Welcome , ' , $_SESSION['username'] . '. You are ' . $_SESSION['age'] . 'years old.';
|
||||
} else{
|
||||
echo 'Please log in.';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
6
exam73/set.php
Normal file
6
exam73/set.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
$_SESSION['username'] = 'alex';
|
||||
$_SESSION['age'] = '21';
|
||||
|
||||
?>
|
||||
8
exam73/unset.php
Normal file
8
exam73/unset.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
unset($_SESSION['username']);
|
||||
|
||||
session_destroy();
|
||||
?>
|
||||
5
exam73/view.php
Normal file
5
exam73/view.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
echo $_COOKIE['username'];
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user