Advertisement
fadhil123

login

Jun 21st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 KB | None | 0 0
  1. <?php require_once('../Connections/growsart.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_growsart, $growsart);
  35. $query_rscustomer = "SELECT * FROM customer";
  36. $rscustomer = mysql_query($query_rscustomer, $growsart) or die(mysql_error());
  37. $row_rscustomer = mysql_fetch_assoc($rscustomer);
  38. $totalRows_rscustomer = mysql_num_rows($rscustomer);
  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['pwd'];
  54. $MM_fldUserAuthorization = "";
  55. $MM_redirectLoginSuccess = "index.php";
  56. $MM_redirectLoginFailed = "login.php?status=gagal";
  57. $MM_redirecttoReferrer = false;
  58. mysql_select_db($database_growsart, $growsart);
  59.  
  60. $LoginRS__query=sprintf("SELECT username, password FROM customer WHERE username=%s AND password=%s",
  61. GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  62.  
  63. $LoginRS = mysql_query($LoginRS__query, $growsart) 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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  84. <html xmlns="http://www.w3.org/1999/xhtml">
  85. <head>
  86. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  87. <title>Login</title>
  88. <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  89. </head>
  90.  
  91. <body style="width:100%; height:100%; background: url(img/Form%20Cart%20-%20Login.png) no-repeat; background-size:100%; ">
  92.  
  93. <div class="container" style="margin-top:2%;">
  94. <h3 class="text-center" style="color:#fff; font-family:'Times New Roman';"> Welcome to </h3>
  95. <h1 class="text-center" style="margin-top:0; color:#fff; font-family:'Times New Roman';"> GrowsArt</h1>
  96. <div class="col-md-4 col-xs-offset-4" style=" font-family: 'jagw 0';" >
  97. <div class="panel panel-default">
  98. <div class="panel-heading" style=" color:#a7a9ab; background-color:#fff;"><h3 class=" text-center" style="font-family: 'jagw 0'; ">MEMBER LOGIN</h3></div>
  99. <div class="panel-body">
  100. <form ACTION="<?php echo $loginFormAction; ?>" role="form" method="POST" name="login">
  101. <div class="form-group"><div class="col-lg-12" style="padding:0;">
  102. <div class="col-lg-2" style="padding-top:1%;">
  103. <img src="img/Form Cart-06.png" width="80%" />
  104. </div>
  105. <div class="col-lg-10" style="padding:0;">
  106. <input type="text" class="form-control" style="color:#a7a9ab;" name="username" placeholder="Username">
  107. </div>
  108. </div>
  109. </div>
  110. <div class="form-group" ><div class="col-lg-12" style="padding:0; margin-top:5%;">
  111. <div class="col-lg-2" style=" padding-top:1%;">
  112. <img src="img/Form Cart-07.png" width="80%" />
  113. </div>
  114. <div class="col-lg-10" style="padding:0;">
  115. <div class="input-group">
  116. <input type="password" class="form-control " name="pwd" placeholder="Password" >
  117. <span class="input-group-btn">
  118. <button class="btn btn-default reveal" type="button" style="margin:0; color:#a7a9ab;"><i class="glyphicon glyphicon-eye-open"></i></button>
  119. </span>
  120. </div></div></div></div>
  121. <div class="form-group col-lg-12" style="padding-left:18%; margin-top:2%; color:#a7a9ab; font-size:12px;">
  122. <input name="remind" type="checkbox" value="remind" /> Remember Me
  123. </div>
  124. <div class="col-lg-12" style=" font-size:12px;">
  125. <div class="col-lg-2 col-xs-offset-1"><img src="img/Form Cart-09 - 7ebae5.png" width="100%" /></div><div class="col-lg-9" style="color:#7ebae5; padding:0;"> Forgot your <u >password</u> ?</div>
  126. </div>
  127.  
  128. <div class="col-lg-6 col-xs-offset-3"><button type="submit" class="btn btn-sm btn-default" style="margin-top:10%; width:100%; background-color:#50a3da; padding:3%; font-size:16px; color:#fff;">LOGIN</button></div>
  129. </form>
  130. </div>
  131. <div class="col-md-12 text-center" style="margin-top:5%;" >
  132. <div class="col-lg-7" style="padding-top:2%; color:#6d6e70; padding-right:0;">Don't have an account ? </div><div class="col-lg-5" style="padding-left:0;"><button type="submit" class="btn btn-sm btn-default" style=" width:100%; background-color:#F5861f; padding:5%; font-size:14px; color:#fff;">REGISTER</button></div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. <script>
  138. $(".reveal").on('click',function() {
  139. var $pwd = $("#pwd");
  140. if ($pwd.attr('type') == 'password') {
  141. $pwd.attr('type', 'text');
  142. } else {
  143. $pwd.attr('type', 'password');
  144. }
  145. });</script>
  146. </body>
  147. </html>
  148. <?php
  149. mysql_free_result($rscustomer);
  150. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement