View Single Post
Old 11-09-2012, 04:15 PM   PM User | #10
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,667
Thanks: 46
Thanked 456 Times in 444 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Sarah, this is what I meant:

PHP Code:
<?php $title "BaisxNick - Activate Your Account"?>
<?php 
require("styles/top.php"); ?>
    <div id='full'>
    <?php
    
    $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>"
;
    
    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");
                
$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");?>
__________________
Please don't be rude: Put your php code in [php][/php] tags. It is a sticky topic at the top of the forum and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote