/account.php
PHP | 51 lines | 45 code | 6 blank | 0 comment | 2 complexity | 7e22d540745f8e2ac886be4647c0c6e1 MD5 | raw file
- <?php
- session_start(); // NEVER forget this!
- include ('database_connection.php');
- include ('functions.php');
- if(!isset($_SESSION['loggedin']))
- {
- die("To access this page, you need to <a href='index.php'>LOGIN</a>"); // Make sure they are logged in!
- } // What the !isset() code does, is check to see if the variable $_SESSION['loggedin'] is there, and if it isn't it kills the script telling the user to log in!
- ?>
-
- <!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">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>User Account</title>
- <link rel="stylesheet" href="quiz.css" type="text/css" />
- </head>
- <body>
- <div id="container">
- <h1>DB-Web Portal</h1>
- <hr>
- <?php
- echo "Hello there, <b>{$_SESSION['name']}!</b>";
- $query_bestscore = "select best_score from dbhomework.users where name=\"{$_SESSION["name"]}\"";
- $handle = mysql_query($query_bestscore) or die(mysql_error());
- while($row = mysql_fetch_assoc($handle)){
- $bestscore = $row["best_score"];
- }
- if(empty($bestscore)){
- echo "<p>You have not yet completed the quiz. Please do this below.</p>";
- $bestscore=-1;
- }
- else{
- echo "<p>Your best quiz score is: $bestscore points.</p>";
- $_SESSION["bestscore"] = $bestscore;
- }
-
-
- echo "<p>". hallOfFame() . "</p>";
- ?>
-
- <p>To do the online quiz, please click the following link below</p>
- <a href='quiz.php'>Quiz</a>
- <hr>
- <p>If you wish to log out, please click on the link below</p>
- <a href='logout.php'>Log Out</a>
-
-
- </div>
- </body>
- </html>