Results 1 to 2 of 2

Thread: registration error

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    registration error

    hello,

    im having another problem this script tells me that my user has been registered but when i check my database its not there can anyone help me please?.

    PHP Code:
    <?php include('styles/top.php'); ?>

        <div id="full">
        <?php
        
        $form 
    "<form action='register.php' method='post'>
        <table cellpadding='10'>
        <tr>
            <td></td>
            <td>All fields with <font color='red'>*</font> are required</td>
        </tr>
        <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>
            <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>Website Address</td>
            <td><input type='text' name='website'></td>
        </tr>
        <tr>
            <td>Youtube Username</td>
            <td><input type='text' name='youtube'></td>
        </tr>
        <tr>
            <td>Bio / About</td>
            <td><textarea name='bio' cols='35' rows='5'></textarea></td>
        </tr>
        <tr>
            <td></td>
            <td><input type='submit' name='submitbtn' value='Register'></td>
        </tr>
        </table>
        </form>"
    ;
        
        if (
    $_POST['submitbtn']){
            
            
    $first_name strip_tags($_POST['firstname']);
            
    $last_name strip_tags($_POST['lastname']);
            
    $username strip_tags($_POST['username']);
            
    $email strip_tags($_POST['email']);
            
    $password strip_tags($_POST['password']);
            
    $repassword strip_tags($_POST['repassword']);
            
    $website strip_tags($_POST['website']);
            
    $youtube strip_tags($_POST['youtube']);
            
    $bio strip_tags($_POST['bio']);
            
            
    $name $_FILES['avatar']['name'];
            
    $type $_FILES['avatar']['type'];
            
    $size $_FILES['avatar']['size'];
            
    $tmpname $_FILES['avatar']['tmp_name'];
            
    $ext substr($namestrrpos($name'.'));        
            
            if (
    $first_name && $last_name && $username && $email && $password && $repassword){
               if (
    $password == $repassword){
                    if (
    strstr($email"@") && strstr($email".") && (strlen($email) >= 6)){
                       
                       require(
    "scripts/connect.php");
                       
                       
    $query mysql_query("SELECT * FROM users 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(md5($password));
                                
    $date date("F d, Y");
                                
                                if (
    $name){
                                    
    move_uploaded_file($tmpname"avatars/$username.$ext");
                                    
    $avatar "$username.$ext";
                                }
                                else
                                    
    $avatar "default.png";
                                    
                                
    $code substr(md5(rand(1111111111999999999999999)), 225);
                                
                                
    mysql_query("INSERT INTO users VALUES('', '$first_name', '$last_name', '$username', $email, '$pass', '$avatar', '$bio', '$website', '$youtube', '$last_login', '0', '$code', '0', '$date')");
                                
                                
    $webmaster "john@yansumkune.co.uk";
                                
    $subject "Activate Your Account";
                                
    $headers "From: John Rodger<$webmaster>";
                                
    $message "Hello $firstname.  Welcome to Yan Sum Kune. Below is a link for you to activate your account on yan sum kune\n\n Click Here to activate your account: http://www.mbappz.co.uk/activate.php?code=$code";
                                
                                
    mail($email$subject$message$headers);
                                
                                echo 
    "<br><center>Thank you for registering. you must now activate your account through the activation email that has been sent to <b>$email</b>.  You must activate your account to beable to login.  If you are having please problems please contact the site admin at <a href='mailto:mark@mbdues.co.uk'>mark@mbdues.co.uk</a>.</center>";
                                
                           }
                           else
                                echo 
    "The email you entered is already taken try again. $form"
                       }
                       else
                            echo 
    "The username you entered is already taken try again. $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 in all the required fields. $form";
            
        }
        else
            echo 
    "$form";
        
        
    ?>
        
        </div>

    <?php include('styles/bottom.php'); ?>
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: registration error

    You should check if your INSERT was successful or not.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width