View Single Post
Old 11-09-2012, 03:53 PM   PM User | #8
SarahBlue
New to the CF scene

 
Join Date: Nov 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
SarahBlue is an unknown quantity at this point
Exclamation Confused :s

<?php $title = "BaisxNick - Activate Your Account"; ?>
<?php require("styles/top.php"); ?>
<div id='full'>
<?php

PHP Code:
$getcode = isset($_GET['code']) ? $_GET['code'] : ''
$form = "<form action='activate.php' method='post'>

<table>

<tr>
<td>Activate Code:</td>
<td><input type='text' name='code' value='$getcode' size='30'></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>";

PHP Code:
if (isset($_POST['code'], $_POST['username'], $_POST['password'])) { 
$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(md5($password));
require("scripts/connect.php");
PHP Code:
$sQry "SELECT * FROM users WHERE username='$username' AND password='$pass'";
 
printf('Running: "%s"' PHP_EOL$sQry);
 
$query mysql_query($sQry) or die('SQL error: ' mysql_error()); 
$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 "Your account has beeen activated u may now login.<a href='login.php'>Click here to log in</a>";

}
else
echo "Your activation code incorrect $form";


}
else
echo "Your username and password are invalid $form";

}
else
echo "You have not supplied a valid code $form";


}
else
echo "You did not fill in the whole form $form";


}
else
echo "$form";


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

Last edited by SarahBlue; 11-09-2012 at 03:57 PM..
SarahBlue is offline   Reply With Quote