Advertisement
Guest User

Untitled

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