|
CS479/579 - Web Programming II
|
Displaying ./code/Sessions/authenticated.php
<?php
include "auth.php";
$auth = new Auth();
if ($auth->authenticated() == false) header("location: login.php");
// include "config.php";
// $error = null;
// if (!isset($_COOKIE['MY_SESSION'])) header("location: login.php");
// $sid = $_COOKIE['MY_SESSION'];
//
// $stmt = $myconn->prepare("SELECT username, ipaddr FROM session WHERE sid=?");
// $stmt->bind_param("s", $sid);
// $stmt->bind_result($username, $ipaddr);
// $stmt->execute();
// if ($stmt->fetch()) {
// if ($ipaddr != $_SERVER['REMOTE_ADDR']) $error = "IP Address does not match session IP";
// else $error = "Logged in with username = $username, from $ipaddr";
// } else header("location: login.php");
// $stmt->close();
?>
<!DOCTYPE html>
<html>
<head>
<title> Authenticated </title>
<meta charset='utf-8'>
</head>
<body>
<h1> Authenticated </h1>
<?php
if ($auth->error != null) echo "<h3> {$auth->error} </h3>\n";
?>
A special page for special people.
<a href='logout.php'> Logout </a>
</body>
</html>
|