Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // <!-- This defines where we are saving the session, then starts the session and defines the session variable -->
- session_save_path("/ceri/homes1/r/rhe15/public_html/CSGROUP/sessions");
- session_start();
- ?><!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>
- <title> CS GROUP SIX </title>
- <link rel="stylesheet" type="text/css" href="main.css" />
- <style type="text/css">
- .menutitle{
- cursor:pointer;
- margin-bottom: 5px;
- background: url('') no-repeat;
- color:#000000;
- width:650px;
- padding: 7px 2px 7px 16px;
- text-align:left;
- font-weight:bold;
- border-style: solid;
- border-radius: 15px 50px;
- font-size: 20px;
- }
- .submenu{
- margin-bottom: 0.5em;
- font-size: 15px;
- width:625px;
- border-style: solid;
- border-radius: 15px 15px 15px 15px;
- padding: 7px 2px 7px 16px;
- margin-left: 25px;
- }
- </style>
- <script type="text/javascript" src="menu.js">
- /***********************************************
- * Switch Menu script- by Martial B of http://getElementById.com/
- * Modified by Dynamic Drive for format & NS4/IE4 compatibility
- * Visit http://www.dynamicdrive.com/ for full source code
- ***********************************************/
- </script>
- </head>
- <body>
- <div id="wrapper">
- <div id="leftcol">
- <div class="smid">
- <div id="masterdiv">
- <img src="crap.png" alt="img">
- <br /> <br />
- <div class="menutitle"><center><?php
- $host = "db.dcs.aber.ac.uk";
- $user = "csgpadm_6";
- $pass = "vg2VTiba";
- $db = "csgp_6_15_16";
- $mysqli = mysqli_connect( $host, $user, $pass, $db);
- if (mysqli_connect_errno($mysqli)){
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- } else {
- echo "connected to sql server";
- }
- if(isset($_SESSION['userlogin'])) {
- echo "Welcome, ". $_SESSION['userlogin'];
- //Takes you to the page where we are clearing the session
- echo "<br /><br /><a href='logout.php'>Click here to log out »</a>";
- } else if(isset($_POST['userlogin'])) {
- // Defining sessions
- $_SESSION['userlogin'] = $_POST['userlogin'];
- //Echoing the users chosen login name
- echo "Welcome, ". $_SESSION['userlogin'];
- } else {
- //Echoing that the user isn't logged in, although the page shouldn't get this far and this should never be seen
- echo "Not logged in.";
- }
- mysqli_select_db($mysqli, $db)
- or die("Unable to select database: " . mysqli_error($mysqli));
- if (isset($_SESSION['userlogin']) &&
- isset($_SESSION['password']))
- {
- // $un_temp = mysql_entities_fix_string($_SERVER['PHP_AUTH_USER']);
- // $pw_temp = mysql_entities_fix_string($_SERVER['PHP_AUTH_PW']);
- $query = "SELECT Username, Password FROM Users WHERE Username='$userlogin', Password='$password'";
- $result = mysqli_query($query);
- if (!$result) die("Database access failed: " . mysqli_error());
- else
- {
- header('WWW-Authenticate: Basic realm="Restricted Section"');
- header('HTTP/1.0 401 Unauthorized');
- die ("Please enter your username and password");
- }
- function mysql_entities_fix_string($string)
- {
- return htmlentities(mysql_fix_string($string));
- }
- function mysql_fix_string($string)
- {
- if (get_magic_quotes_gpc()) $string = stripslashes($string);
- return mysql_real_escape_string($string);
- }
- }
- ?>
- What do you want to do today?
- <br /><br /><a href="tasks.php">» The tasks ahead!</a>
- <br /><a href="test.html">» Edit slaves!</a>
- <br /><a href="test.html">» Create workload!</a> <br /><br />
- </center>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement