Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require('/home/phpboard/public_html/includes/config.php');
- ?>
- <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
- <tr>
- <form name="form1" method="post" action="">
- <td>
- <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
- <tr>
- <td colspan="3"><strong>Registration</strong></td>
- </tr>
- <tr>
- <td width="78">Username</td>
- <td width="6">:</td>
- <td width="294"><input name="username" type="username" id="username"></td>
- </tr>
- <tr>
- <td>Password</td>
- <td>:</td>
- <td><input name="password" type="password" id="password"></td>
- </tr>
- <tr>
- <td>Retype Password</td>
- <td>:</td>
- <td><input name="password2" type="password" id="password"></td>
- </tr>
- <tr>
- <td>Email</td>
- <td>:</td>
- <td><input name="email" type="email" id="email"></td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td><input type="submit" name="submit" value="Register"></td>
- </tr>
- </table>
- </td>
- </form>
- </tr>
- </table>
- <html><center><a href="/index.php">Click Here To Go To Main Page</a></center><html>
- <?php
- if(isset($_POST['submit']))
- {
- // Here we save the things people wrote in the variables
- $username=$_POST['username'];
- $password=$_POST['password'];
- $password2=$_POST['password2'];
- $email=$_POST['email'];
- // Here we set a variable that will check in the database if the username is taken
- $result = mysql_query("SELECT * FROM UserData");
- $users = mysql_query("SELECT UserID FROM UserData");
- $count=mysql_num_rows($result);
- // Here we check if people wrote the right thing, so we validate what they are trying to submit
- if($username=="")
- {
- // If no username is typed
- echo "<html><center><html>Please enter your username.<html></center><html>";
- }
- else if($count=="1")
- {
- // If the username is taken
- echo "<html><center><html>Username is already taken<html></center><html>";
- }
- else if($password=="")
- {
- // If no password is typed
- echo "<html><center><html>Please enter your password.<html></center><html>";
- }
- else if($password2=!$password)
- {
- // If the passwords doesn't match
- echo "<html><center><html>Passwords did not match.<html></center><html>";
- }
- else if($email=="")
- {
- // If no email is typed
- echo "<html><center><html>Please enter your email address.<html></center><html>";
- }
- else
- {
- $encrypt_password=md5($password);
- mysql_query("INSERT INTO UserData (UserID, Username, Password, Email, Reputation, Post, Status)
- VALUES ('$users', '$username', '$encrypt_password', '$email', '0', '0', 'User')");
- echo "<html><center><html>Register Completed!<html></center><html>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement