Advertisement
Guest User

Untitled

a guest
Jun 6th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. <?
  2. $serverneeded = false;
  3. require_once ("common/commonserver.php");
  4.  
  5. session_start ();
  6.  
  7. $success = false;
  8.  
  9. if (isset ($_SESSION ['id']) && is_numeric ($_SESSION ['id']) &&
  10. isset ($_SESSION ['ip']) && ($_SESSION ['ip'] == $_SERVER ['REMOTE_ADDR']))
  11. {
  12. if (($level == 'admin') || ($level == 'tech'))
  13. header ("Location: admin/servers.php");
  14. else
  15. header ("Location: index.php");
  16.  
  17. exit;
  18. }
  19.  
  20. include "common/connectsql.php";
  21.  
  22. if (isset ($_POST['email']) && isset ($_POST['pass']) &&
  23. isset ($_POST['Login']))
  24. {
  25. $user = stripslashes ($_POST['email']);
  26. $pass = stripslashes ($_POST['pass']);
  27.  
  28. $result = mysql_query ("SELECT * FROM users ".
  29. "WHERE `email` = '".mysql_escape_string ($user)."' ".
  30. "AND `pass` = '".mysql_escape_string ($pass)."' ".
  31. "LIMIT 1");
  32. echo mysql_error();
  33.  
  34.  
  35. if ($result && mysql_num_rows ($result))
  36. {
  37. if ((mysql_result ($result, 0, 1) != "user") ||
  38. ((mysql_result ($result, 0, 1) == "user") &&
  39. (mysql_result ($result, 0, 2) != '')))
  40. {
  41. $_SESSION ['id'] = mysql_result ($result, 0, 0);
  42. $_SESSION ['user'] = $user;
  43. $_SESSION ['ip'] = $_SERVER ['REMOTE_ADDR'];
  44. $_SESSION ['level'] = mysql_result ($result, 0, 1);
  45. $_SESSION ['server'] = mysql_result ($result, 0, 2);
  46.  
  47. header ("Location: index.php");
  48.  
  49. $success = true;
  50. }
  51. }
  52.  
  53. @mysql_free_result ($result);
  54. }
  55.  
  56. if ($success)
  57. exit;
  58. ?>
  59. <html>
  60. <head>
  61. <title>Untitled Document</title>
  62. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  63. <link href="stylesheet.css" rel="stylesheet" type="text/css">
  64. </head>
  65.  
  66. <body>
  67. <table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  68. <tr>
  69. <td><p><img src="images/logo.jpg" width="125" height="55"></p>
  70. <form method=POST action="">
  71. <p><strong>User Login:<br>
  72. </strong>Please enter your login info.</p>
  73. <p>Email:<br>
  74. <input name="email" type="text" class="txtfield" size="20">
  75. <br>
  76. Password:<br>
  77. <input name="pass" type="password" class="txtfield" size="20">
  78. <br>
  79. <input value="Login" name="Login" type="submit">
  80. </p>
  81. <p> <a href="forgotpass.php">Forgot Password?</a></p>
  82. </form>
  83. </td>
  84. </tr>
  85. </table>
  86. </body>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement