Guest User

Untitled

a guest
Mar 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. <?
  2. /**
  3. * Register.php
  4. *
  5. * Displays the registration form if the user needs to sign-up,
  6. * or lets the user know, if he's already logged in, that he
  7. * can't register another name.
  8. *
  9. * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
  10. * Last Updated: August 19, 2004
  11. */
  12. include("include/session.php");
  13. ?>
  14.  
  15. <html>
  16. <title>Registration Page</title>
  17. <body>
  18.  
  19. <?
  20. /**
  21. * The user is already logged in, not allowed to register.
  22. */
  23. if($session->logged_in){
  24. echo "<h1>Registered</h1>";
  25. echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
  26. ."<a href=\"main.php\">Main</a>.</p>";
  27. }
  28. /**
  29. * The user has submitted the registration form and the
  30. * results have been processed.
  31. */
  32. else if(isset($_SESSION['regsuccess'])){
  33. /* Registration was successful */
  34. if($_SESSION['regsuccess']){
  35. echo "<h1>Registered!</h1>";
  36. echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "
  37. ."you may now <a href=\"main.php\">log in</a>.</p>";
  38. }
  39. /* Registration failed */
  40. else{
  41. echo "<h1>Registration Failed</h1>";
  42. echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
  43. ."could not be completed.<br>Please try again at a later time.</p>";
  44. }
  45. unset($_SESSION['regsuccess']);
  46. unset($_SESSION['reguname']);
  47. }
  48. /**
  49. * The user has not filled out the registration form yet.
  50. * Below is the page with the sign-up form, the names
  51. * of the input fields are important and should not
  52. * be changed.
  53. */
  54. else{
  55. ?>
  56.  
  57. <h1>Register</h1>
  58. <?
  59. if($form->num_errors > 0){
  60. echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
  61. }
  62. ?>
  63. <form action="process.php" method="POST">
  64. <table align="left" border="0" cellspacing="0" cellpadding="3">
  65. <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
  66. <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
  67. <tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr>
  68. <tr><td colspan="2" align="right">
  69. <input type="hidden" name="subjoin" value="1">
  70. <input type="submit" value="Join!"></td></tr>
  71. <tr><td colspan="2" align="left"><a href="main.php">Back to Main</a></td></tr>
  72. </table>
  73. </form>
  74.  
  75. <?
  76. }
  77. ?>
  78.  
  79. </body>
  80. </html>
Add Comment
Please, Sign In to add comment