www.webdeveloper.com
Results 1 to 2 of 2

Thread: After email conformation

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Posts
    57

    After email conformation

    Hi, Iím not sure why this not working, Iím trying to create signup form with email confirmation, they are two different table name in mysql one is called temps_users and other use us users.
    When new member signed up it sending all of the new member profile to the temps_user tables, until member verify email by email conformation, if confirm then it will transfer the profile from temps_users to users tables and delete profile in temps_users.
    So far I have done that and works great when transfer from temps_users to users, but after transfer the data profile from temps_users to users, meaning member are activity, I want to redirect to login.php page for them to login in before get into the member home page, the problem I have is that is not redirect to login.php page and delete profile from temps_users.

    Please see the code area where it said $result2=mysql_query($sql); (see in bold area)
    From that line is suppost to be redirect to login.php page and delete profile from temps_users.
    Is not working what did I missed!

    Code:
    <?php
    
    include('config.php');
    
    // Passkey that got from link 
    $passkey=$_GET['passkey'];
    $tbl_name1="temps_users";
    
    // Retrieve data from table where row that match this passkey 
    $sql1="SELECT * FROM temps_users WHERE confirm_code ='$passkey'";
    $result1=mysql_query($sql1);
    
    // If successfully queried 
    if($result1){
    
    // Count how many row has this passkey
    $count=mysql_num_rows($result1);
    
    // if found this passkey in our database, retrieve data from table "temp_members_db"
    if($count==1){
    
    $rows=mysql_fetch_array($result1);
    $username=$rows['username'];
    $first_name=$rows['first_name'];
    $last_name=$rows['last_name'];
    $email=$rows['email'];
    $password=$rows['password']; 
    $type=$rows['type'];
    
    
    // Insert data that retrieves from "temp_members_db" into table "registered_members" 
         $sql2=mysql_query("INSERT INTO users(username,password,email,type,first_name,last_name )VALUES('$username','$password','$email','$type','$first_name','$last_name' )");
    	    $sql=mysql_query("SELECT uid FROM users WHERE username='$username'");
         $row=mysql_fetch_array($sql);
         $uid=$row['uid'];
         $friend_query=mysql_query("INSERT INTO friends(friend_one,friend_two,role)VALUES('$uid','$uid','me')");
    	 
    	 
    
         return $uid ;
    $result2=mysql_query($sql);
    }
    
    // if not found passkey, display message "Wrong Confirmation code" 
    else {
    echo "Wrong Confirmation code";
    }
    
    // if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
    if($friend_query){
    
    header("Location:login.php");
    
    // Delete information of this user from table "temp_members_db" that has this passkey 
    $sql3="DELETE FROM temps_users WHERE confirm_code = '$passkey'";
    $result3=mysql_query($sql3);
    
    }
    
    }
    ?>

  2. #2
    Join Date
    May 2004
    Location
    chennai, tamil nadu, India
    Posts
    450
    "INSERT INTO friends(friend_one,friend_two,role)VALUES('$uid','$uid','me')")
    Is the above SQL statement getting executed correctly ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles