Advertisement
Guest User

Untitled

a guest
Mar 28th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 'On');
  3. session_start();
  4. include_once 'db/dbconnect.php';
  5. include_once 'classes/User.php';
  6. include_once 'classes/UserDAO.php';
  7.  
  8. $userDAO = new UserDAO();
  9.  
  10. if ($_SESSION['user'] != null) {
  11. header("Location: home.php");
  12. }
  13.  
  14. if (isset($_POST['btn-login'])) {
  15. $username = $_POST['username'];
  16. $upass = $_POST['pass'];
  17.  
  18. $newUser = $userDAO->check_login($username, $upass);
  19. if ($newUser != null) {
  20. $_SESSION["user"] = $newUser;
  21. header("Location: home");
  22. } else {
  23. ?>
  24. <script>alert('wrong details');</script>
  25. <?php
  26. }
  27.  
  28. }
  29.  
  30. ?>
  31.  
  32. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  33. <html xmlns="http://www.w3.org/1999/xhtml">
  34. <head>
  35. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  36. <title>VoluCron BotWatch</title>
  37. <link rel="stylesheet" href="css/index.css" type="text/css"/>
  38. <link rel="shortcut icon" type="image/png" href="resources/favicon.ico"/>
  39. </head>
  40. <body>
  41. <center>
  42. <img src="resources/mainpage.png">
  43.  
  44. <div id="txtindex">
  45. <h3>
  46. VoluCron Users: <?php echo $userDAO->getTotalUsers(); ?>
  47. </h3>
  48. </div>
  49. <div id="login-form">
  50. <form method="post">
  51. <table align="center" width="30%" border="0">
  52. <tr>
  53. <td><input type="text" name="username" placeholder="Your Username" required/></td>
  54. </tr>
  55. <tr>
  56. <td><input type="password" name="pass" placeholder="Your Password" required/></td>
  57. </tr>
  58. <tr>
  59. <td>
  60. <button type="submit" name="btn-login">Sign In</button>
  61. </td>
  62. </tr>
  63. </table>
  64. </form>
  65. </div>
  66. <div class="tos">By logging in you accept our <a href="/resources/VOLUCRONTOS.txt">TOS</a></div>
  67.  
  68. </center>
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement