Jump to content

HELP IDK what is happening.


lalonde4

Recommended Posts

So I am creating a community site and I just can for the life of me figure out why this page is not working.

 

<?php $title = "Productions - Register";?>
<?php require("styles/top.php"); ?>
<div id='full'>
    <?php

$form = "<form action='register.php' method='post'>
<table>
<tr>
	<td>First Name:</td>
	<td><input type='text' name='firstname'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Last Name:</td>
	<td><input type='text' name='lastname'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Username:</td>
	<td><input type='text' name='username'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Email:</td>
	<td><input type='text' name='email'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Password:</td>
	<td><input type='password' name='password'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Confirm Password:</td>
	<td><input type='password' name='repassword'><font color='red'>*</font></td>
</tr>
<tr>
	<td>Avatar:</td>
	<td><input type='file' name='avatar'></td>
</tr>
<tr>
	<td>Bio/About Me:</td>
	<td><textarea name='bio' cols='35' rows='5'></textarea></td>
</tr>
<tr>
	<td>Website:</td>
	<td><input type='text' name='website'></td>
</tr>
<tr>
	<td>Youtube:</td>
	<td><input type='text' name='youtube'></td>
</tr>
<tr>
	<td>Facebook:</td>
	<td><input type='text' name='facebook'></td>
</tr>
<tr>
	<td>Twitter:</td>
	<td><input type='text' name='twitter'></td>
</tr>
<tr>
	<td></td>
	<td><input type='submit' name='submitbtn' value='Register'></td>
</tr>
<tr>
	<td></td>
	<td><font color='red'>*</font> = Required</td>
</tr>
</table>
</form>";

if ($_POST['submitbtn']){

		$firstname = strip_tags($_POST['firstname']);
		$lastname = strip_tags($_POST['lastname']);
		$username = strip_tags($_POST['username']);
		$email = strip_tags($_POST['email']);
		$password = strip_tags($_POST['password']);
		$repassword = strip_tags($_POST['repassword']);
		$bio = strip_tags($_POST['bio']);
		$website = strip_tags($_POST['webite']);
		$youtube = strip_tags($_POST['youtube']);
		$facebook = strip_tags($_POST['facebook']);
		$twitter = strip_tags($_POST['twitter']);

		$name = $_FILES['avatar']['name'];
		$type = $_FILES['avatar']['type'];
		$size = $_FILES['avatar']['size'];
		$tmpname = $_FILES['avatar']['tmp_name'];
		$ext = substr($name, strrpos($name, '.'));

		if ($firstname && $lastname && $username && $email && $password){
			if ($password == $repassword){

				if (strstr($email, "@") && strstr($email, ".") && (strlen($email) >=6)){

					require("scripts/config.php");

					$query = mysql_query("SELECT * FROM user WHERE username='$username'");$numrows = mysql_num_rows($query);
					if ($numrows == 0){
						$query = mysql_query("SELECT * FROM users WHERE email='$email'");$numrows = mysql_num_rows($query);
					if ($numrows == 0){

						$pass = md5($password);
						$date = date("F d, Y");

						if ($name){
							move_uploaded_file($tmpname, "avatars/$username.$ext");
						}
						else
							$avatar = "defav.png";

						$code = substr(md5(rand(111111111111, 999999999999)), 2,25);

						mysql_query("INSERT INTO table_users VALUES ('', '$firstname', '$lastname', '$email', '$pass', '$avatar', '$bio', '$website', '$youtube', '$facebook', '$twitter', '', '0', '$code', '0', '$date')");

						$webmaster = "admin@aagaming.net";
						$subject = "Activation Email";
						$headers = "From: AAG GoD<$webmaster>";
						$message = "Hello $username! Thank you for registering! Below is your activation link.\n\n You must click this link in order to log in. http://www.aagaming.net/productions/activate.php?code=$code";

						mail($email, $subject, $message, $headers);

						echo "Your activation email has been sent to <b>$email</b>. There you will follow a link in order to login. You must complete the activation proccess in order to login. If you run into any problems please email the site administrators. Send an email to <a href='mailto:admin@aagaming.net'>admin@aagaming.net</a>";

					}
					else
						echo"That email is already in use. $form";

					}
					else
						echo"That username is already in use. $form";


				}
				else
					echo "You did not enter a valid email. $form";
			}
			else
				echo "Your passwords did not match. $form";
		}
		else
			echo "You did not fill out all the required fields. $form";
}
else
	echo "$form";

    ?>
</div>
<?php require("styles/bottom.php"); ?>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.