Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. <?php
  2. include_once("include/events/ga_badge_item_events.php");
  3. $obj = new ga_badge_item_events();
  4. $obj->trigger_item_43($userid);
  5. if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['form_name'] == 'loginform')
  6. {
  7. $success_page = './page2.php';
  8. $error_page = basename(__FILE__);
  9. $mysql_server = 'xxxxxx';
  10. $mysql_username = 'xxxxx';
  11. $mysql_password = 'xxxxx';
  12. $mysql_database = 'xxxxx';
  13. $mysql_table = 'ga_users';
  14. $crypt_pass = md5($_POST['password']);
  15. $found = false;
  16. $fullname = '';
  17. $session_timeout = 600;
  18. $db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
  19. if (!$db)
  20. {
  21. die('Failed to connect to database server!<br>'.mysqli_error($db));
  22. }
  23. mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
  24. $sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".mysqli_real_escape_string($db, $_POST['username'])."'";
  25. $result = mysqli_query($db, $sql);
  26. if ($data = mysqli_fetch_array($result))
  27. {
  28. if ($crypt_pass == $data['password'] && $data['active'] != 0)
  29. {
  30. $found = true;
  31. $fullname = $data['fullname'];
  32. }
  33. }
  34. mysqli_close($db);
  35. if($found == false)
  36. {
  37. header('Location: '.$error_page);
  38. exit;
  39. }
  40. else
  41. {
  42. if (session_id() == "")
  43. {
  44. session_start();
  45. }
  46. $_SESSION['username'] = $_POST['username'];
  47. $_SESSION['fullname'] = $fullname;
  48. $_SESSION['expires_by'] = time() + $session_timeout;
  49. $_SESSION['expires_timeout'] = $session_timeout;
  50. $rememberme = isset($_POST['rememberme']) ? true : false;
  51. if ($rememberme)
  52. {
  53. setcookie('username', $_POST['username'], time() + 3600*24*30);
  54. setcookie('password', $_POST['password'], time() + 3600*24*30);
  55. }
  56. header('Location: '.$success_page);
  57. exit;
  58. }
  59. }
  60. $username = isset($_COOKIE['username']) ? $_COOKIE['username'] : '';
  61. $password = isset($_COOKIE['password']) ? $_COOKIE['password'] : '';
  62.  
  63. ?>
  64. <!doctype html>
  65. <html>
  66. <head>
  67. <meta charset="utf-8">
  68. <title>Untitled Page</title>
  69. <meta name="generator" content="WYSIWYG Web Builder 10 - http://www.wysiwygwebbuilder.com">
  70. <link href="Untitled1.css" rel="stylesheet">
  71. <link href="login.css" rel="stylesheet">
  72. </head>
  73. <body>
  74. <div id="wb_Login1" style="position:absolute;left:162px;top:99px;width:446px;height:183px;text-align:right;z-index:0;">
  75. <form name="loginform" method="post" action="<?php echo basename(__FILE__); ?>" id="loginform">
  76. <input type="hidden" name="form_name" value="loginform">
  77. <table id="Login1">
  78. <tr>
  79. <td class="Login1_header" colspan="2" style="height:20px;">Log In</td>
  80. </tr>
  81. <tr>
  82. <td style="height:20px;width:201px">User Name:</td>
  83. <td style="text-align:left"><input class="Login1_input" name="username" type="text" id="username" value="<?php echo $username; ?>"></td>
  84. </tr>
  85. <tr>
  86. <td style="height:20px">Password:</td>
  87. <td style="text-align:left"><input class="Login1_input" name="password" type="password" id="password" value="<?php echo $password; ?>"></td>
  88. </tr>
  89. <tr>
  90. <td>&nbsp;</td><td style="text-align:left;height:20px"><input id="rememberme" type="checkbox" name="rememberme">Remember me</td>
  91. </tr>
  92. <tr>
  93. <td>&nbsp;</td><td style="text-align:left;vertical-align:bottom"><input class="Login1_button" type="submit" name="login" value="Log In" id="login"></td>
  94. </tr>
  95. </table>
  96. </form>
  97. </div>
  98. </body>
  99. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement