SHARE
TWEET

Untitled

a guest Jan 28th, 2016 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // <!-- This defines where we are saving the session, then starts the session and defines the session variable -->
  3.  
  4.   session_save_path("/ceri/homes1/r/rhe15/public_html/CSGROUP/sessions");
  5. session_start();
  6.  if(!isset($_SESSION["userlogin"]) || empty($_SESSION["userlogin"])){
  7.      header("location: login.php");}
  8.    
  9. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11.  <head>
  12.   <title> CS GROUP SIX </title>
  13.   <link rel="stylesheet" type="text/css" href="main.css" />
  14.   <style type="text/css">
  15.   .menutitle{
  16.   cursor:pointer;
  17.   margin-bottom: 5px;
  18.   background: url('') no-repeat;
  19.   color:#000000;
  20.   width:650px;
  21.   padding: 7px 2px 7px 16px;
  22.   text-align:left;
  23.   font-weight:bold;
  24.   border-style: solid;
  25.   border-radius: 15px 50px;
  26.   font-size: 20px;
  27.   }
  28.   .submenu{
  29.   margin-bottom: 0.5em;
  30.   font-size: 15px;
  31.   width:625px;
  32.   border-style: solid;
  33.   border-radius: 15px 15px 15px 15px;
  34.   padding: 7px 2px 7px 16px;
  35.   margin-left: 25px;
  36.   }
  37.   </style>
  38.   <script type="text/javascript" src="menu.js">
  39.   /***********************************************
  40.   * Switch Menu script- by Martial B of http://getElementById.com/
  41.   * Modified by Dynamic Drive for format & NS4/IE4 compatibility
  42.   * Visit http://www.dynamicdrive.com/ for full source code
  43.   ***********************************************/
  44.   </script>
  45.  
  46.  
  47.  
  48.  </head>
  49.  <body>
  50.  
  51.  <div id="wrapper">
  52.  
  53.  
  54.  
  55.  
  56.         <div id="leftcol">
  57.  
  58.             <div class="smid">
  59.  
  60.             <div id="masterdiv">
  61.         <img src="crap.png" alt="img">
  62. <br /> <br />
  63.                 <div class="menutitle"><center><?php
  64.  
  65.  
  66.  
  67.  
  68.  $host = "db.dcs.aber.ac.uk";
  69. $user = "csgpadm_6";
  70. $pass = "vg2VTiba";
  71. $db = "csgp_6_15_16";
  72.  $mysqli = mysqli_connect( $host, $user, $pass, $db);
  73.     if (mysqli_connect_errno($mysqli)){
  74.         echo "Failed to connect to MySQL: " . mysqli_connect_error();
  75.         } else {
  76.         echo "connected to sql server<br /><br />";
  77.         }
  78. if(isset($_SESSION['userlogin'])) {
  79.    echo     "Welcome, ".  $_SESSION['userlogin'];
  80.    //Takes you to the page where we are clearing the session
  81.    echo "<br /><a href='logout.php'>Click here to log out &#187;</a><br /><br />";
  82.  } else if(isset($_POST['userlogin'])) {
  83.       // Defining sessions
  84.   $_SESSION['userlogin'] = $_POST['userlogin'];
  85.  
  86.       //Echoing the users chosen login name
  87.    echo     "Welcome, ".  $_SESSION['userlogin'];
  88.    echo "<br /><a href='logout.php'>Click here to log out &#187;</a><br /><br />";
  89. } else {
  90.       //Echoing that the user isn't logged in, although the page shouldn't get this far and this should never be seen
  91.   echo "Not logged in.";
  92. }        
  93.   mysqli_select_db($mysqli, $db)
  94.   or die("Unable to select database: " . mysqli_error($mysqli));
  95.   if (isset($_SESSION['userlogin']) &&
  96.   isset($_SESSION['password']))
  97.    {
  98.    // $un_temp = mysql_entities_fix_string($_SERVER['PHP_AUTH_USER']);
  99.   //  $pw_temp = mysql_entities_fix_string($_SERVER['PHP_AUTH_PW']);
  100.     $query = "SELECT Username, Password FROM Users WHERE Username='$userlogin', Password='$password'";
  101.     $result = mysqli_query($query);
  102.     if (!$result) die("Database access failed: " . mysqli_error());
  103.    
  104.    
  105.     else
  106.      {
  107.       header('WWW-Authenticate: Basic realm="Restricted Section"');
  108.       header('HTTP/1.0 401 Unauthorized');
  109.       die ("Please enter your username and password");
  110.      }
  111.     function mysql_entities_fix_string($string)
  112.      {
  113.       return htmlentities(mysql_fix_string($string));
  114.      }
  115.       function mysql_fix_string($string)
  116.      {
  117.       if (get_magic_quotes_gpc()) $string = stripslashes($string);
  118.       return mysql_real_escape_string($string);
  119.      }
  120.    }
  121.  
  122.  
  123.  
  124. ?>
  125.                     What do you want to do today?
  126.  
  127.                     <br /><br /><a href="tasks.php">&#187; The tasks ahead!</a>
  128.                     <br /><a href="newuser.php">&#187; Edit slaves!</a>
  129.                     <br /><a href="test.html">&#187; Create workload!</a> <br /><br />
  130.  
  131.  
  132.                 </center>
  133.                 </div>
  134.  
  135.  
  136.  
  137.             </div>
  138.  
  139.  
  140.             </div>
  141.            
  142.             </div>
  143.         </div>
  144.  
  145.  
  146.  </body>
  147. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top