Advertisement
KHIT

downsgaming_login

Feb 22nd, 2012
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.87 KB | None | 0 0
  1. <?php require_once('Connections/downsgaming.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. mysql_select_db($database_downsgaming, $downsgaming);
  35. $query_users = "SELECT * FROM users";
  36. $users = mysql_query($query_users, $downsgaming) or die(mysql_error());
  37. $row_users = mysql_fetch_assoc($users);
  38. $totalRows_users = mysql_num_rows($users);
  39. ?>
  40. <?php
  41. // *** Validate request to login to this site.
  42. if (!isset($_SESSION)) {
  43.  session_start();
  44. }
  45.  
  46. $loginFormAction = $_SERVER['PHP_SELF'];
  47. if (isset($_GET['accesscheck'])) {
  48.  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  49. }
  50.  
  51. if (isset($_POST['username'])) {
  52.  $loginUsername=$_POST['username'];
  53.  $password=$_POST['password'];
  54.  $MM_fldUserAuthorization = "";
  55.  $MM_redirectLoginSuccess = "index.php";
  56.  $MM_redirectLoginFailed = "login.php";
  57.  $MM_redirecttoReferrer = false;
  58.  mysql_select_db($database_downsgaming, $downsgaming);
  59.  
  60.  $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
  61.    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  62.  
  63.  $LoginRS = mysql_query($LoginRS__query, $downsgaming) or die(mysql_error());
  64.  $loginFoundUser = mysql_num_rows($LoginRS);
  65.  if ($loginFoundUser) {
  66.     $loginStrGroup = "";
  67.    
  68.     if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
  69.     //declare two session variables and assign them
  70.     $_SESSION['MM_Username'] = $loginUsername;
  71.     $_SESSION['MM_UserGroup'] = $loginStrGroup;      
  72.  
  73.     if (isset($_SESSION['PrevUrl']) && false) {
  74.       $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
  75.     }
  76.     header("Location: " . $MM_redirectLoginSuccess );
  77.   }
  78.   else {
  79.     header("Location: ". $MM_redirectLoginFailed );
  80.   }
  81. }
  82. ?>
  83. <!DOCTYPE HTML>
  84. <html>
  85. <head>
  86. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  87. <title>Login</title>
  88. <link href="style.css" rel="stylesheet" type="text/css" />
  89. <link rel="icon" href="images/favicon.ico" />
  90. <style type="text/css">
  91. body {
  92.     background-image:url(images/login_back.png);
  93.     background-repeat:no-repeat;
  94.         text-align: center;
  95.         color: #FFF;
  96.         font-size: 12pt;
  97. }
  98. </style>
  99. </head>
  100.  
  101. <body>
  102.     <div id="login_window">
  103. <form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
  104.  
  105.     <p>&nbsp;</p>
  106.     <p>&nbsp;</p>
  107.     <p>Brugernavn:
  108.     <label for="username"></label>
  109.   <input name="username" type="text" id="username" style="background-color:#2b2b2b; color: #FFF; font-size: 12pt;" size="25">
  110.   </p>
  111.   <p>&nbsp;</p>
  112.   <p>&nbsp;</p>
  113.   <p>Password: &nbsp;&nbsp;
  114.     <label for="password"></label>
  115.     <input name="password" type="password" id="password" style="background-color:#2b2b2b; color:#FFF; font-size: 12pt;" size="25">
  116. </p>
  117.   <p>&nbsp;</p>
  118.   <p>&nbsp;</p>
  119.   <p>
  120.     <input type="submit" name="login" id="login" value="Login">
  121.   </p>
  122. </form></div>
  123. </body>
  124. </html>
  125. <?php
  126. mysql_free_result($users);
  127. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement