Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.56 KB | None | 0 0
  1. <?php
  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.  */
  10. include("include/session.php");
  11. ?>
  12.  
  13. <html>
  14. <head>
  15.  
  16. <title>Registration Page</title>
  17. <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" type="text/css" media="all" />
  18.    
  19.         <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
  20.         <script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
  21.        
  22.        
  23.  
  24.      
  25.         <script>
  26.                function toggleField(val) {
  27. var o = document.getElementById('other');
  28. (val == 'other')? o.style.display = 'block' : o.style.display = 'none';
  29. }
  30.     $(function() {
  31.         $( "button, input:submit, a", ".demo" ).button();
  32.         $( "a", ".demo" ).click(function() { return true; });
  33.     });
  34.     </script>
  35.     <style type="text/css">
  36.                     /*demo page css*/
  37.                     body{ font: 100% "Trebuchet MS", sans-serif; margin: 50px;}
  38.                     .demoHeaders { margin-top: 2em; }
  39.                     #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
  40.                     #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
  41.                     ul#icons {margin: 0; padding: 0;}
  42.                     ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
  43.                     ul#icons span.ui-icon {float: left; margin: 0 4px;}
  44.                 </style>
  45.                 </head>
  46.            
  47. <body>
  48. <div class="demo">
  49. <?
  50. /**
  51.  * The user is already logged in, not allowed to register.
  52.  */
  53. if($session->logged_in){
  54.    echo "<h1>Registered</h1>";
  55.    echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
  56.        ."<a href=\"main.php\">Main</a>.</p>";
  57. }
  58. /**
  59.  * The user has submitted the registration form and the
  60.  * results have been processed.
  61.  */
  62. else if(isset($_SESSION['regsuccess'])){
  63.    /* Registration was successful */
  64.    if($_SESSION['regsuccess']){
  65.       echo "<h1>Registered!</h1>";
  66.       echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "
  67.           ."you may now <a href=\"main.php\">log in</a>.</p>";
  68.    }
  69.    /* Registration failed */
  70.    else{
  71.       echo "<h1>Registration Failed</h1>";
  72.       echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
  73.           ."could not be completed.<br>Please try again at a later time.</p>";
  74.    }
  75.    unset($_SESSION['regsuccess']);
  76.    unset($_SESSION['reguname']);
  77. }
  78. /**
  79.  * The user has not filled out the registration form yet.
  80.  * Below is the page with the sign-up form, the names
  81.  * of the input fields are important and should not
  82.  * be changed.
  83.  */
  84. else{
  85. ?>
  86.  
  87. <h1>Register</h1>
  88. <?
  89. if($form->num_errors > 0){
  90.    echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
  91. }
  92. ?>
  93. <form action="process.php" method="POST">
  94. <table align="left" border="0" cellspacing="0" cellpadding="3">
  95. <tr><td><font color="red">* </font>Username:</td><td><input type="text" name="user" maxlength="30" size="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
  96. <tr><td><font color="red">* </font>Password:</td><td><input type="password" name="pass" maxlength="30" size="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
  97. <tr><td><font color="red">* </font>Email:</td><td><input type="text" name="email" maxlength="50" size="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr>
  98. <tr><td><font color="red">* </font>Name (First, Last):   </td><td><input type="text" name="name" maxlength="50" size="50" value="<? echo $form->value("name"); ?>"></td><td><? echo $form->error("name"); ?></td></tr>
  99. <tr><td>Phone :   </td><td><input type="text" name="phone" maxlength="20" size="20" value="<? echo $form->value("phone"); ?>"></td><td><? echo $form->error("phone"); ?></td></tr>
  100. <tr><td><font color="red">* </font>College Attended :   </td><td><input type="text" name="college" maxlength="50" size="50" value="<? echo $form->value("college"); ?>"></td><td><? echo $form->error("college"); ?></td></tr>
  101. <tr><td>Favorite College : </td><td><input type="text" name="favcollege" maxlength="50" size="50"></td></tr>
  102. <tr><td>Favorite Sport :   </td><td><input type="text" name="favsport" maxlength="30" size="30"></td></tr>
  103. <tr><td>Home Town :  </td><td><input type="text" name="hometown" maxlength="50" size="50"></td></tr>
  104. <tr><td>Do you own a PowerBlaster? :  </td>
  105. <td><select name="own" id="ownpb">
  106.     <option value="No">No</option>
  107.     <option value="Yes">Yes</option>
  108. </select></td></tr>
  109. <tr><td>What do you like most about PB? :  </td><td>
  110. <select name="sel" id="sel" onChange="toggleField(this.value);">
  111.     <option value="Don't have PowerBlaster">I don't have a Powerblaster</option>
  112.     <option value="Versatility">Versatility</option>
  113.     <option value="Functionality">Functionality</option>
  114.     <option value="How much fun it is">How much fun it is</option>
  115.     <option value="Difficulty">Difficulty of the Workout</option>
  116.     <option value="Creativity">Its Creativity</option>
  117.     <option value="other">Other (please specify)</option>
  118. </select></td><td>
  119. <input type="text" name="other" id="other" style="display: none;">
  120. </td></tr>
  121. <tr><td colspan="0" align="left"><a href="main.php">Back to Main</a></td>
  122. <td colspan="0" align="right">
  123. <input type="hidden" name="subjoin" value="1">
  124. <input type="submit" value="Join!"></td></tr>
  125. </table>
  126. </form>
  127.  
  128. <?
  129. }
  130. ?>
  131. </div>
  132. </body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement