Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. <?php
  2. include('includes/database.php');
  3. $error = '';
  4. if(isset($_POST['submit']))
  5. {
  6. if(isset($_POST['myusername']) && isset($_POST['mypassword']) &&
  7. isset($_POST['mypasswordrepeat']))
  8. {
  9. $myusername = $_POST['myusername'];
  10. $mypassword = $_POST['mypassword'];
  11. $mypasswordrepeat = $_POST['mypasswordrepeat'];
  12. if($myusername != '' && $mypassword != '' && $mypasswordrepeat != '')
  13. {
  14. if(strcmp($mypassword, $mypasswordrepeat) == 0)
  15. {
  16. $myusername = stripslashes($myusername);
  17. $mypassword = stripslashes($mypassword);
  18. $myusername = mysqli_real_escape_string($mysqli,$myusername);
  19. $mypassword =
  20. md5(mysqli_real_escape_string($mysqli,$mypassword));
  21. $sql = mysqli_query( $mysqli, "
  22. INSERT INTO
  23. members (
  24. username,
  25. password
  26. )VALUES(
  27. '$myusername',
  28. '$mypassword'
  29. )") or die(mysqli_error());
  30. header("location: registrationsuccessful.php");
  31. exit();
  32. }
  33. else
  34. {
  35. $error = "Passwords do not match!";
  36. }
  37. }
  38. else
  39. {
  40. $error = "All fields are mandatory!";
  41. }
  42. }
  43. else
  44. {
  45. $error = "All fields are mandatory!";
  46. }
  47. }
  48. ?>
  49. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  50. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  51. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  52. <head>
  53. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  54. <meta name="description" content="" />
  55. <meta name="keywords" content="" />
  56. <meta name="author" content="" />
  57. <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
  58. <title>1stWebDesigner PHP Template</title>
  59. </head>
  60. <body>
  61. <div id="wrapper">
  62. <div id="header">
  63. <?php include('includes/header.php'); ?>
  64. </div> <!-- end #header -->
  65. <div id="content">
  66. <br/>
  67. <br/>
  68. <table width="300" border="0" align="center" cellpadding="0"
  69. cellspacing="1">
  70. <tr>
  71. <form name="registration" method="post" action="<?php
  72. echo($_SERVER['PHP_SELF']) ?>">
  73. <td>
  74. <table width="100%" border="0" cellpadding="3"
  75. cellspacing="1" bgcolor="#FFFFFF">
  76. <tr>
  77. <td colspan="3"><strong>Member registration </strong></td>
  78. </tr>
  79. <tr>
  80. <td width="78">Username</td>
  81. <td width="6">:</td>
  82. <td width="294"><input name="myusername" type="text"
  83. id="myusername"></td>
  84. </tr>
  85. <tr>
  86. <td>Password</td>
  87. <td>:</td>
  88. <td><input name="mypassword" type="password"
  89. id="mypassword"></td>
  90. </tr>
  91. <tr>
  92. <td>Repeat Password</td>
  93. <td>:</td>
  94. <td><input name="mypasswordrepeat" type="password"
  95. id="mypasswordrepeat"></td>
  96. </tr>
  97. <tr>
  98. <td>&nbsp;</td>
  99. <td>&nbsp;</td>
  100. <td><input type="submit" name="submit"
  101. value="Register"></td>
  102. </tr>
  103. <tr>
  104. <td colspan="3" style="color:red;"><?php echo $error ?></td>
  105. </tr>
  106. </table>
  107. </td>
  108. </form>
  109. </tr>
  110. </table>
  111. <br/>
  112. <br/>
  113. </div> <!-- end #content -->
  114. <div id="footer">
  115. <?php include('includes/footer.php'); ?>
  116. </div> <!-- end #footer -->
  117. </div> <!-- end #wrapper -->
  118. </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement