Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Register.php
- *
- * Displays the registration form if the user needs to sign-up,
- * or lets the user know, if he's already logged in, that he
- * can't register another name.
- *
- */
- include("include/session.php");
- ?>
- <html>
- <head>
- <title>Registration Page</title>
- <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" type="text/css" media="all" />
- <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
- <script>
- function toggleField(val) {
- var o = document.getElementById('other');
- (val == 'other')? o.style.display = 'block' : o.style.display = 'none';
- }
- $(function() {
- $( "button, input:submit, a", ".demo" ).button();
- $( "a", ".demo" ).click(function() { return true; });
- });
- </script>
- <style type="text/css">
- /*demo page css*/
- body{ font: 100% "Trebuchet MS", sans-serif; margin: 50px;}
- .demoHeaders { margin-top: 2em; }
- #dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
- #dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
- ul#icons {margin: 0; padding: 0;}
- ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
- ul#icons span.ui-icon {float: left; margin: 0 4px;}
- </style>
- </head>
- <body>
- <div class="demo">
- <?
- /**
- * The user is already logged in, not allowed to register.
- */
- if($session->logged_in){
- echo "<h1>Registered</h1>";
- echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
- ."<a href=\"main.php\">Main</a>.</p>";
- }
- /**
- * The user has submitted the registration form and the
- * results have been processed.
- */
- else if(isset($_SESSION['regsuccess'])){
- /* Registration was successful */
- if($_SESSION['regsuccess']){
- echo "<h1>Registered!</h1>";
- echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "
- ."you may now <a href=\"main.php\">log in</a>.</p>";
- }
- /* Registration failed */
- else{
- echo "<h1>Registration Failed</h1>";
- echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
- ."could not be completed.<br>Please try again at a later time.</p>";
- }
- unset($_SESSION['regsuccess']);
- unset($_SESSION['reguname']);
- }
- /**
- * The user has not filled out the registration form yet.
- * Below is the page with the sign-up form, the names
- * of the input fields are important and should not
- * be changed.
- */
- else{
- ?>
- <h1>Register</h1>
- <?
- if($form->num_errors > 0){
- echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
- }
- ?>
- <form action="process.php" method="POST">
- <table align="left" border="0" cellspacing="0" cellpadding="3">
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <tr><td>Favorite College : </td><td><input type="text" name="favcollege" maxlength="50" size="50"></td></tr>
- <tr><td>Favorite Sport : </td><td><input type="text" name="favsport" maxlength="30" size="30"></td></tr>
- <tr><td>Home Town : </td><td><input type="text" name="hometown" maxlength="50" size="50"></td></tr>
- <tr><td>Do you own a PowerBlaster? : </td>
- <td><select name="own" id="ownpb">
- <option value="No">No</option>
- <option value="Yes">Yes</option>
- </select></td></tr>
- <tr><td>What do you like most about PB? : </td><td>
- <select name="sel" id="sel" onChange="toggleField(this.value);">
- <option value="Don't have PowerBlaster">I don't have a Powerblaster</option>
- <option value="Versatility">Versatility</option>
- <option value="Functionality">Functionality</option>
- <option value="How much fun it is">How much fun it is</option>
- <option value="Difficulty">Difficulty of the Workout</option>
- <option value="Creativity">Its Creativity</option>
- <option value="other">Other (please specify)</option>
- </select></td><td>
- <input type="text" name="other" id="other" style="display: none;">
- </td></tr>
- <tr><td colspan="0" align="left"><a href="main.php">Back to Main</a></td>
- <td colspan="0" align="right">
- <input type="hidden" name="subjoin" value="1">
- <input type="submit" value="Join!"></td></tr>
- </table>
- </form>
- <?
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement