Modernvox Posted January 21, 2010 Share Posted January 21, 2010 Hi Guyz (& Girlz) I have this email verification code I would like to use. I am wondering if it can be edited in such a way: I want the user to be able to post an ad on my site quickly without having to sign up. At the same token I want to make them activate the posting by clicking on a link by email. I only want to check the md5 hash, not there user name and all that. I also want to ban Gmail users(I understand some honest folks use this service, but i would rather not deal with all the spam from other countries. Any help much appreciated as always. <? include('config.php'); // Passkey that got from link $passkey=$_GET['passkey']; $tbl_name1="temp_members_db"; // Retrieve data from table where row that match this passkey $sql1="SELECT * FROM $tbl_name1 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); $name=$rows['name']; $email=$rows['email']; $password=$rows['password']; $country=$rows['country']; $tbl_name2="registered_members"; // Insert data that retrieves from "temp_members_db" into table "registered_members" $sql2="INSERT INTO $tbl_name2(name, email, password, country)VALUES('$name', '$email', '$password', '$country')"; $result2=mysql_query($sql2); } // 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($result2){ echo "Your account has been activated"; // Delete information of this user from table "temp_members_db" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3); } } ?> config.php - config your database <? $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name //Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); ?> Link to comment https://forums.phpfreaks.com/topic/189341-can-this-code-be-chopped-up-to-fit-my-needs/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.