Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. ///////////////////////////////login.html///////////////////////////////////////////////
  2.  
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  4. <html>
  5. <head>
  6. <title>The Moray College Surf Shop </title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <link rel="stylesheet" type="text/css" href="mystyle.css" />
  9.  
  10. </head>
  11. <center>
  12. <div id="bodyone">
  13. <body>
  14. <div id="title"
  15. <p><font size="3"><strong>The Moray College Surf Shop </strong></font></p>
  16. </div>
  17. <div id="bar">
  18. </div>
  19.  
  20.  
  21. <form name="form1" method="post" action="loginshop.php">
  22. <div id="cusone">
  23. <p><strong>Existing Customers</strong></p>
  24.  
  25. <p>User Name
  26. <input name="username" type="text" >
  27.  
  28. Password
  29. <input name="password" type="password" size="40" maxlength="40">
  30. </p>
  31. <p>
  32. <input type="submit" name="Submit" value="Submit">
  33. <input type="reset" name="Submit2" value="Reset">
  34. </p>
  35. </div>
  36.  
  37. </form>
  38. <p>For new customers <a href="register.php">click here</a></p>
  39. </div>
  40. </center>
  41. <div id="bar">
  42. </div>
  43. <p>&nbsp;</p>
  44. <p>&nbsp;</p>
  45. </body>
  46. </div>
  47. </html>
  48.  
  49. /////////////////////////////////////////////
  50. /////////////////register.php////////////////////
  51.  
  52. <html>
  53.  
  54. <head>
  55.  
  56. The Moray College Surf Shop
  57.  
  58. </head>
  59.  
  60. <body>
  61.  
  62. <?php
  63. session_start();
  64.  
  65. ?>
  66.  
  67. <form name="form1" action="memberregistered.php" method = "post">
  68.  
  69. <?php
  70.  
  71.  
  72.  
  73. if (isset($_SESSION['info'])) {
  74.  
  75. echo "<input type=\"hidden\" name=\"customerno\" value=\"customerno". $_SESSION['info']['customerno'] ."\">";
  76.  
  77. }
  78.  
  79. ?>
  80.  
  81. <p><h1>UHI Surf shop New Customer</h1></p>
  82.  
  83. <p>First Name
  84.  
  85. <input name="firstname" type="text" size="20" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['firstname'] ."\"";}?>>
  86.  
  87. </p>
  88.  
  89. <p>Surname
  90.  
  91. <input name="lastname" type="text" size="20" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['surname'] ."\"";}?>>
  92.  
  93. </p>
  94.  
  95. <p>Address
  96.  
  97. <input name="address" type="text" size="25" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['address'] ."\"";}?>>
  98.  
  99. </p>
  100.  
  101. <p>Town
  102.  
  103. <input name="town" type="text" size="20" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['town'] ."\"";}?>>
  104.  
  105. </p>
  106.  
  107. <p>Post Code
  108.  
  109. <input name="postcode" type="text" size="10" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['postcode'] ."\"";}?>>
  110.  
  111. </p>
  112.  
  113. <p>Email Address
  114.  
  115. <input name="email" type="text" size="40" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['emailaddress'] ."\"";}?>>
  116.  
  117. </p>
  118.  
  119. <p>User name
  120.  
  121. <input name="username" type="text" size="40" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['username'] ."\"";}?>>
  122.  
  123. </p>
  124.  
  125. <p>Password
  126.  
  127. <input name="password" type="text" size="40" <?php if (isset($_SESSION['info'])) {echo " value=\"". $_SESSION['info']['password'] ."\"";}?>>
  128.  
  129. </p>
  130.  
  131. <br><br>
  132.  
  133.  
  134.  
  135. <input type="submit" name="submit" value="submit">
  136.  
  137. <input type="reset" name="Reset" value="Reset"> </p>
  138.  
  139. </form>
  140.  
  141. </body>
  142.  
  143. </html>
  144.  
  145. ////////////////////////////////////
  146. ////////////////loginshop.php///////////
  147.  
  148. <html><head>The Moray College Surf Shop </head><body><h1>Member Search Results</h1>
  149.  
  150. <?php
  151. session_start();
  152.  
  153.  
  154. $username=@$_POST['username'];
  155.  
  156. $password=@$_POST['password'];
  157.  
  158.  
  159.  
  160. $db = mysql_connect('127.0.0.1', 'root', '') or die(mysql_error());
  161.  
  162.  
  163.  
  164. mysql_select_db('surf');
  165.  
  166. $query = "select * from customers where username = '$username' and password = '$password'";
  167.  
  168. $result = mysql_query($query);
  169.  
  170. $num_results = mysql_num_rows($result);
  171.  
  172.  
  173. if (!$num_results > 0) {
  174.  
  175. echo "<form action='loginshop.php' method='post'>
  176.  
  177. Username
  178.  
  179.  
  180.  
  181. <input type='text' name='username' maxlength='13' size='13'></br>
  182.  
  183. Password
  184.  
  185. <input type='text' name='password' maxlength='60' size='30'></br>
  186.  
  187.  
  188.  
  189. <input name='Continue' type='submit' value='Continue'>
  190.  
  191. </form>";
  192.  
  193. } else {
  194.  
  195.  
  196. echo "If you would like to change your details please <a href='register.php?a=change'>click here</a>";
  197.  
  198.  
  199.  
  200. $_SESSION['info'] = mysql_query($query);
  201.  
  202. }
  203.  
  204. ?>
  205.  
  206. </body></html>
  207.  
  208. //////////////////////////////////////
  209. /////////////////memberregister.php
  210.  
  211. <html>
  212. <head>
  213. <title>The Moray College Surf Shop MEMBER REGISTRATION</title>
  214. </head>
  215. <body>
  216. <h1>The Moray College Surf Shop Member Registration</h1>
  217.  
  218. <?php
  219. $firstname=$_POST['firstname'];
  220. $lastname=$_POST['lastname'];
  221. $address=$_POST['address'];
  222. $town=$_POST['town'];
  223. $postcode=$_POST['postcode'];
  224. $email=$_POST['email'];
  225. $username=$_POST['username'];
  226. $password=$_POST['password'];
  227.  
  228. $db = mysql_connect('127.0.0.1', 'root', '');
  229. if (!$db)
  230. {
  231. echo 'Error: mysql_error() Could not connect to database. Please try again later.';
  232. exit;
  233. }
  234. else
  235. {
  236. mysql_select_db('surf');
  237. $query = "insert into customers(firstname,lastname,address,town,postcode,email,username,password) values ('$firstname','$lastname','$address','$town','$postcode','$email','$username' ,'$password')";
  238. $result = mysql_query($query);
  239. if ($result)
  240. echo 'Member inserted';
  241. else
  242. echo 'Did not work';
  243. }
  244. ?>
  245. <p>Click <a href="login.html">here</a> to return to the login page</font></p>
  246. </body>
  247. </html>
  248. /////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement