Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. <?php require_once('Connections/config.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. if (PHP_VERSION < 6) {
  7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8. }
  9.  
  10. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12. switch ($theType) {
  13. case "text":
  14. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15. break;
  16. case "long":
  17. case "int":
  18. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19. break;
  20. case "double":
  21. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22. break;
  23. case "date":
  24. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25. break;
  26. case "defined":
  27. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28. break;
  29. }
  30. return $theValue;
  31. }
  32. }
  33. ?>
  34. <?php
  35. // *** Validate request to login to this site.
  36. if (!isset($_SESSION)) {
  37. session_start();
  38. }
  39.  
  40. $loginFormAction = $_SERVER['PHP_SELF'];
  41. if (isset($_GET['accesscheck'])) {
  42. $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  43. }
  44.  
  45. if (isset($_POST['login'])) {
  46. $loginUsername=$_POST['login'];
  47. $password=$_POST['senha'];
  48. $MM_fldUserAuthorization = "";
  49. $MM_redirectLoginSuccess = "painel.php";
  50. $MM_redirectLoginFailed = "erro.php";
  51. $MM_redirecttoReferrer = false;
  52. mysql_select_db($database_config, $config);
  53.  
  54. $LoginRS__query=sprintf("SELECT login, senha FROM login WHERE login=%s AND senha=%s",
  55. GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  56.  
  57. $LoginRS = mysql_query($LoginRS__query, $config) or die(mysql_error());
  58. $loginFoundUser = mysql_num_rows($LoginRS);
  59. if ($loginFoundUser) {
  60. $loginStrGroup = "";
  61.  
  62. if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
  63. //declare two session variables and assign them
  64. $_SESSION['MM_Username'] = $loginUsername;
  65. $_SESSION['MM_UserGroup'] = $loginStrGroup;
  66.  
  67. if (isset($_SESSION['PrevUrl']) && false) {
  68. $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
  69. }
  70. header("Location: " . $MM_redirectLoginSuccess );
  71. }
  72. else {
  73. header("Location: ". $MM_redirectLoginFailed );
  74. }
  75. }
  76. error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED); require_once('Connections/config.php'); ?>
  77. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  78. <html xmlns="http://www.w3.org/1999/xhtml">
  79. <head>
  80. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  81. <title>Documento sem título</title>
  82. <style type="text/css">
  83. #form1 div table tr td div {
  84. color: #FFF;
  85. }
  86. #form1 div table tr td div strong {
  87. color: #000;
  88. }
  89. #form1 div table tr td div strong {
  90. color: #FFF;
  91. }
  92. </style>
  93. </head>
  94.  
  95. <body>
  96. <p>&nbsp;</p>
  97. <p>&nbsp;</p>
  98. <form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
  99. <div align="center">
  100. <table width="220" border="0,5">
  101. <tr>
  102. <td colspan="2" bgcolor="#000066"><div align="center"><strong>Entre com suas credenciais</strong></div></td>
  103. </tr>
  104. <tr>
  105. <td width="75">Login:</td>
  106. <td width="129"><label for="login"></label>
  107. <input type="text" name="login" id="login" /></td>
  108. </tr>
  109. <tr>
  110. <td>Senha:</td>
  111. <td><label for="senha"></label>
  112. <input type="password" name="senha" id="senha" /></td>
  113. </tr>
  114. </table>
  115. <p>
  116. <input type="submit" name="logar" id="logar" value="Logar" />
  117. </p>
  118. </div>
  119. <div align="center"></div>
  120. </form>
  121. <p>&nbsp;</p>
  122. </body>
  123. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement