Jump to content

lalonde4

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Posts posted by lalonde4

  1. When I go to the link in the email it takes me to activate.php and then i enter in my username and password and then hit activate. Problem that comes is after hitting the submit it takes me to a 404 error web page.

  2. Yeah i tried displaying like the db connection see if it connected and it does but do you have any other debugging im new in php actually so Im kinda getting on my feet if you can understand you all are a big help.

  3. Now when I send the activation link in an email to a user. They go to the activate page and then enter in their info but then the method doesnt work. Can anyone see where that might be. I have done a few debugging. but not all.

     

    <?php $title = "Productions - Activations"; ?>
    <?php  require("styles/top.php"); ?>
    <div id='full'>
    <?php
        $getcode = $_GET['code'];
        
        $form = "<form action='activate.php method='post'>
    <table>
    <tr>
    	<td>Activate Code:</td>
    	<td><input type='text' name='code' value='$getcode'></td>
    </tr>
    <tr>
    	<td>Username:</td>
    	<td><input type='text' name='username'></td>
    </tr>
    <tr>
    	<td>Password:</td>
    	<td><input type='password' name='password'></td>
    </tr>
    <tr>
    	<td></td>
    	<td><input type='submit' name='submitbtn' value='activate'></td>
    </tr>
    </table>
    </form>";
    
    if ($_POST['submitbtn']){
    	$code = strip_tags($_POST['code']);
    	$username = strip_tags($_POST['username']);
    	$password = strip_tags($_POST['password']);
    
    	if ($code && $username && $password){
    		if (strlen($code) == 25){
    			$pass = md5($password);
    			require("scripts/config.php");
    			$query = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$pass'");
    
    			$numrows = mysql_num_rows($query);
    			if ($numrows == 1){
    
    				$row = mysql_fetch_assoc($query);
    				$dbcode = $row['code'];
    
    				if ($code == $dbcode){
    					mysql_query("UPDATE users SET active='1' WHERE username='$username'");
    					echo $sql;
    
    mysql_query($query) or die(mysql_error());
    
    					echo "Your account is now active you may now login.<a href='login.php'>Click here to login.</a>";
    				}
    				else
    					echo "Your acttivation code was incorrect. $form";
    			}
    			else
    				echo "Your username and password are invalid. $form";
    
    		}
    		else
    			echo "You have not registered your information. $form";
    
    	}
    	else
    		echo "You did not fill out the entire form. $form";
    
    }
        else
    	echo "$form";
    
        ?>
    </div>
    
    <?php require("styles/bottom.php"); ?>

  4. try this:

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

         

    Then take the query that prints to your screen and try running it in phpmyadmin directly to see the error you get there.

     

    My guess is your columns don't match up.

     

    You should never do an insert without specifying the columns.... if you ever add columns to your table, you'll break the query.

     

    It should be like this:

     

    INSERT INTO table_name (col1, col2) VALUES ('data1', 'data2');

     

    This is the error i get with this try

     

    INSERT INTO users VALUES ('', 'Matt', 'Lalonde', 'lalonde2011@gmail.com', 'b8955b3dda83d2aa5c07c00e86229f85', 'defav.png', '', '', '', '', '', '', '0', 'c6f1a668129cbeb2a52f2edfc', '0', 'May 29, 2012')Column count doesn't match value count at row 1

  5. New code but still wont post into database

     

     

    <?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 users VALUES('', '$firstname', '$lastname', '$email', '$pass', '$avatar', '$bio', '$website', '$youtube', '$facebook', '$twitter', '', '0', '$code', '0', '$date')")
    
    						or die(mysql_error());
    
    
    
    						$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"); ?>

  6. 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"); ?>

  7. Ok so I cant get the register page to insert the information into my database the config file is linked it works but just inserting the info just doesnt work.

     

    <?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"); ?>

×
×
  • 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.