PageRenderTime 64ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 0ms

/account.php

https://bitbucket.org/rkrebbers/homework-final
PHP | 51 lines | 45 code | 6 blank | 0 comment | 2 complexity | 7e22d540745f8e2ac886be4647c0c6e1 MD5 | raw file
 1<?php
 2session_start(); // NEVER forget this!
 3include ('database_connection.php');
 4include ('functions.php');
 5if(!isset($_SESSION['loggedin']))
 6{
 7    die("To access this page, you need to <a href='index.php'>LOGIN</a>"); // Make sure they are logged in!
 8} // 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!
 9?>
10
11<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
12<html xmlns="http://www.w3.org/1999/xhtml">
13<head>
14<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
15<title>User Account</title>
16<link rel="stylesheet" href="quiz.css" type="text/css" />
17</head>
18<body>
19<div id="container">
20<h1>DB-Web Portal</h1>
21<hr>
22<?php 
23echo "Hello there, <b>{$_SESSION['name']}!</b>";
24$query_bestscore = "select best_score from dbhomework.users where name=\"{$_SESSION["name"]}\"";
25$handle = mysql_query($query_bestscore) or die(mysql_error());
26while($row = mysql_fetch_assoc($handle)){
27$bestscore = $row["best_score"];
28}
29if(empty($bestscore)){
30echo "<p>You have not yet completed the quiz. Please do this below.</p>";
31$bestscore=-1;
32}
33else{
34echo "<p>Your best quiz score is: $bestscore points.</p>";
35$_SESSION["bestscore"] = $bestscore;
36}
37
38
39echo "<p>". hallOfFame() . "</p>";
40?>
41
42<p>To do the online quiz, please click the following link below</p>
43<a href='quiz.php'>Quiz</a>
44<hr>
45<p>If you wish to log out, please click on the link below</p>
46<a href='logout.php'>Log Out</a>
47
48
49</div>
50</body>
51</html>