Jump to content

Any Ideas on method?


lalonde4

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/263339-any-ideas-on-method/
Share on other sites

Archived

This topic is now archived and is 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.