forked from rahbirul/PHP_MongoDB_Packt_Book_Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo_session1.php
32 lines (27 loc) · 1.08 KB
/
mongo_session1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
//Session started by requiring the script
require('session.php');
//Generate a random number
$random_number = rand();
//Put the number into session
$_SESSION['random_number'] = $random_number;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="style.css" />
<title>Using the SessionManager...Page 1</title>
</head>
<body>
<div id="contentarea">
<div id="innercontentarea">
<h2>Using the SessionManager...Page 1</h2>
<p>Random number generated <span style="font-weight:bold;"><?php echo $_SESSION['random_number']; ?></span></p>
<p>PHP session id <span style="text-decoration:underline;"><?php echo session_id(); ?></span></p>
<a href="mongo_session2.php">Go to next page</a>
</div>
</div>
</body>
</html>