Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. if (isset($_POST["email"]) && isset($_POST["password"])) {
  2. $manager = $_POST["email"];
  3. $password = sha1(sha1($_POST['password']).$_POST['password']);
  4. $stores = $_POST["stores"];
  5.  
  6. // Connect to the MySQL database
  7. include "config/connect.php";
  8.  
  9. $stmt = mysqli_prepare(
  10. $db_conx,
  11. "SELECT email, password, storeShop
  12. FROM storename
  13. WHERE email = ?
  14. AND password = ?
  15. AND storeShop = ?"
  16. );
  17. $manager = $_POST["email"];
  18. $password = sha1(sha1($_POST['password']).$_POST['password']);
  19. $stores = $_POST["stores"];
  20. //after validation, of course
  21. mysqli_stmt_bind_param($stmt, "sss", $manager, $password, $stores);
  22. mysqli_stmt_execute($stmt);
  23. if (mysqli_affected_rows($db_conx))
  24. {
  25. mysqli_stmt_close($stmt);//<-- CLEAN UP AFTER YOURSELF!
  26. //update was successful
  27. $id = mysqli_insert_id($db_conx);
  28. }
  29.  
  30.  
  31. $existCount = mysqli_num_rows($query); // count the row nums
  32. if ($existCount == 1) { // evaluate the count
  33. while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
  34. $storeShop = $row["storeShop"];
  35. }
  36. $_SESSION["storeShop"] = $storeShop;
  37. $_SESSION["manager"] = $manager;
  38. $_SESSION["password"] = $password;
  39. $_SESSION['storeShop'] = $storeShop;
  40. header("location: dashboard");
  41. exit();
  42. } else {
  43. echo "wrong information entered";
  44. exit();
  45. }
  46. }
  47.  
  48. $sql = "SELECT * FROM storename WHERE email='$manager' AND password='$password' AND storeShop='$stores'";
  49.  
  50.  
  51. $query = mysqli_query($db_conx, $sql);
  52.  
  53. if (isset($_POST["email"]) && isset($_POST["password"])) {
  54. $manager = $_POST["email"];
  55. $password = sha1(sha1($_POST['password']).$_POST['password']);
  56. $stores = $_POST["stores"];
  57.  
  58. // Connect to the MySQL database
  59. include "config/connect.php";
  60.  
  61. $stmt = mysqli_prepare(
  62. $db_conx,
  63. "SELECT email, password, storeShop
  64. FROM members
  65. WHERE email = ?
  66. AND password = ?
  67. AND storeShop = ?"
  68. );
  69. $manager = $_POST["email"];
  70. $password = sha1(sha1($_POST['password']).$_POST['password']);
  71. $stores = $_POST["stores"];
  72. //after validation, of course
  73. mysqli_stmt_bind_param($stmt, "sss", $manager, $password, $stores);
  74. mysqli_stmt_execute($stmt);
  75. if (mysqli_affected_rows($db_conx))
  76. {
  77. $existCount = mysqli_stmt_affected_rows($stmt);
  78. mysqli_stmt_execute($stmt); // count the row nums
  79. if ($existCount == 1) { // evaluate the count
  80. while($row = mysqli_fetch_array($stmt, MYSQLI_ASSOC)){
  81. $storeShop = $row["storeShop"];
  82. }
  83. $_SESSION["storeShop"] = $storeShop;
  84. $_SESSION["manager"] = $manager;
  85. $_SESSION["password"] = $password;
  86. $_SESSION['storeShop'] = $storeShop;
  87. header("location: dashboard");
  88. mysqli_stmt_close($stmt);
  89. exit();
  90. } else {
  91. header("Location: data");
  92. exit();
  93. }
  94. //<-- CLEAN UP AFTER YOURSELF!
  95. //update was successful
  96. }
  97.  
  98.  
  99. }
  100.  
  101. if (isset($_POST["email"]) && isset($_POST["password"])) {
  102. $manager = $_POST["email"];
  103. $password = sha1(sha1($_POST['password']).$_POST['password']);
  104. $stores = $_POST["stores"];
  105.  
  106. // Connect to the MySQL database
  107. include "config/connect.php";
  108.  
  109. $stmt = mysqli_prepare(
  110. $db_conx,
  111. "SELECT email, password, storeShop
  112. FROM members
  113. WHERE email = ?
  114. AND password = ?
  115. AND storeShop = ?"
  116. );
  117. $manager = $_POST["email"];
  118. $password = sha1(sha1($_POST['password']).$_POST['password']);
  119. $stores = $_POST["stores"];
  120. //after validation, of course
  121. mysqli_stmt_bind_param($stmt, "sss", $manager, $password, $stores);
  122. mysqli_stmt_execute($stmt);
  123. if (mysqli_affected_rows($db_conx))
  124. {
  125. $existCount = mysqli_stmt_affected_rows($stmt); // count the row nums
  126. if ($existCount == 1) { // evaluate the count
  127. if (mysqli_stmt_affected_rows($stmt))
  128. {
  129. while($row = mysqli_fetch_array($stmt, MYSQLI_ASSOC)){
  130. $storeShop = $row["storeShop"];
  131. }
  132. $_SESSION["storeShop"] = $storeShop;
  133. $_SESSION["manager"] = $manager;
  134. $_SESSION["password"] = $password;
  135. $_SESSION['storeShop'] = $storeShop;
  136. header("location: dashboard");
  137. mysqli_stmt_close($stmt);
  138. exit();
  139.  
  140. } else {
  141. header("Location: data");
  142. exit();
  143. }
  144. }
  145. //<-- CLEAN UP AFTER YOURSELF!
  146. //update was successful
  147. }
  148. }
  149.  
  150. $existCount = mysqli_num_rows($query);
  151.  
  152. $existCount = mysqli_stmt_affected_rows($stmt);
  153.  
  154. if (mysqli_stmt_affected_rows($stmt))
  155. {
  156. while($row = mysqli_fetch_array($stmt, MYSQLI_ASSOC)){
  157. $storeShop = $row["storeShop"];
  158. }
  159. $_SESSION["storeShop"] = $storeShop;
  160. $_SESSION["manager"] = $manager;
  161. $_SESSION["password"] = $password;
  162. $_SESSION['storeShop'] = $storeShop;
  163. header("location: dashboard");
  164. mysqli_stmt_close($stmt);
  165. exit();
  166.  
  167. } else {
  168. header("Location: data");
  169. exit();
  170. }
  171.  
  172. $stmt = $db_conx->prepare("SELECT email, password, storeShop
  173. FROM storename
  174. WHERE email = ?
  175. AND password = ?
  176. AND storeShop = ?");
  177. $stmt->bind_param('sss', $manager, $password, $stores);
  178. $stmt->execute();
  179. $stmt->bind_result($manager, $password, $stores);
  180. $stmt->store_result();
  181. if($stmt->num_rows == 1) //To check if the row exists
  182. {
  183. while($stmt->fetch()) //fetching the contents of the row
  184.  
  185. {
  186. $_SESSION["storeShop"] = $storeShop;
  187. $_SESSION["manager"] = $manager;
  188. $_SESSION["password"] = $password;
  189. $_SESSION['storeShop'] = $storeShop;
  190. header("location: dashboard");
  191. exit();
  192. }
  193.  
  194. }
  195. else {
  196. header("Location: data");
  197. exit();
  198. }
  199. $stmt->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement