i want to add a feature that when registering it sends a email with a link to verify that there email address is real and is in use. then when the email link is click registration is then activated and only then will they be able to login sucessfully

ive added a email address: feild to the registration form

i now gather i will have to add at least email adress feild to the database table, is this the only onle one i will need to add another.

also any help with a script that send this is gratful getting a bit sick of trying to read too many tuorials today.

    add an activation field too into your table, then write some kind of an encrypted string.

    if you google on SHA1() you will find lots of useful random code generator.

    If you ready with this code ( $hash ), lets make a link to an activations.php , and send with an email:

    	$to = $_POST["email"]; 
    	$title = "Registration ..."; //it will the emails title
    	$message= "You have registered into [page]: \r";
    	$message.= "Please click here to activate Your account:\r";
    	$message.= "http://www.mysite.com/program_folder/my_users_members_activate.php?activate=$hash \r";
    
    if(mail( $to, $title, $message ))
    print "Activation email has sent!<br/ >";
    

    After make an activate.php where you select the activation code from the table, and if its in, make a form to confirm the user's password. If its matches, lets update the table to make the user enabled now!

    If you still need more examples, just ask 🙂

      wow thats most usefull info ive had on all the php forums all day though i dont think im quite that far as im literally new to php.
      anyways i added email feild to form, also added email and registered feild to database table.

      now im at the stage that when people are registering it only adds the usser name and password and doesnt make a entry to the email feild.
      i thought it was a case of just expanding

      user_register ($POST['username'], $POST['password']);
      to include the email like

      user_register ($POST['username'], $POST['password']);

      but this hasnt worked, am i doing something wrong or do i have do do something else?

      i understand most the code you sent except the last

      $message.= "http://www.mysite.com/program_folder/my_users_members_activate.php?activate=$hash \r";

      im guessing that in the email this displays the encrypted code link? though im no totally sure what i have to put here.

        add email, and activation_code fields into your database/table.

        but you have to insert email and this $hash into your table too.

        $hash = $activation_code = SHA1($_POST['email'].time());
        $email = mysql_real_escape_string($_POST['email']);
        $username = mysql_real_escape_string($_POST['username']);
        $password = mysql_real_escape_string($_POST['password']);
        
        $query = "INSERT INTO users (id,activation_code, email, username, password)
        VALUES ('','$activation_code','$email','$username','".md5($password)."')";
        

        after you run this query, lets sent the email for the activation.

          Write a Reply...