• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

ne help look here for deatils

sytodave88

New Member
i need some one who can but in a codeing in to my register script where it send the user a email and the user has to click the link to confrim it


here is the register code

PHP:
<?
// Register Process, register.php

// Includes the Constants
include("cons.php");

// sets all the variables needed to register
$pass = $_GET['pass']; // set $pass as the first pass
$pass2 = $_GET['pass2']; // sets $pass2 as the re-entered pass
$name = $_GET['name']; // sets $name as the name chosen
$email=$_GET['email'];
$country=$_GET['country'];
$gender=$_GET['gender'];

// Processing the data
if (strlen($name) >= 15) {
$error = "* Username too long, Max is 15 characters";
$err = 1;
}
if (strlen($name) <= 3) {
$error = "* Username too short, Min is 4 characters";
$err = 1;
}
if ($name) { // if $name is set
$re = mysql_num_rows(mysql_query("SELECT * FROM user WHERE user='$name'"));
  if ($re >= 1) { // If the username exists
    $error = "* Username already in use"; // Set $error
	$err = 1; // set $err as 1
  }
  else { // user doesn't exist
    if ($pass == $pass2) { // If the passwords match
      $pass = md5($pass); // Encodes the pass
	  if (eregi('[<>]',$name)) {
	  $error = "* No HTML allowed"; // No HTML in name
	  $err = 1;
	  }
	  else {
	  if (!$err) { // If there are no errors
	    if (mysql_num_rows(mysql_query("SELECT * FROM user")) == 0) {
	      mysql_query("INSERT INTO user (user, pass, userlevel) VALUES ('$name','$pass', '9')"); // Creates the Admin
	    }
	    else {
          mysql_query("INSERT INTO user (user, pass, userlevel,email) VALUES ('$name','$pass', '1','$email')"); // Creates the user
			mysql_query("INSERT INTO online_status (username) VALUES ('$name')");
			mysql_query("INSERT INTO crimes (username) VALUES ('$name')");
			mysql_query("INSERT INTO gtas (username) VALUES ('$name')");
			mysql_query("INSERT INTO bj_games (username) VALUES ('$name')");
			mysql_query("INSERT INTO profiles (username) VALUES ('$name')");
			mysql_query("INSERT INTO user_stats (username, country, gender) VALUES ('$name', '$country', '$gender')");
	    }
	    $reg = "Registration successful!"; // Sets $reg as a sucess message
	    header("Location: login.php?reg=$reg"); // Re-locates to the login screen
	  }
	  }
    }
    else { // The passwords don't match
      $error = "* Passwords different!"; // Sets $error
	  $err = 2; // Sets $err as 2
    }
  }
}
else { // If $name isn't set
  $error = "* Enter a username"; // sets $error
  $err = 1; // sets $err as 1
}
if ($err >= 1) { // if $err is greater than or equal to 1
header("Location: reg.php?error=$error&err=$err"); // re-locates to the registration page with the error!
}
?>
 
Add a new field to the user table called verified and make it a SMALLINT. Or use rand to create a random number and add a string and add it to a field called authcode.

Use the mail function to send an email:

PHP:
        mail($email,$_GET['name']; - Account",$_GET['name']; ."\nhttp://www.thisisourlink.com/register.php?authcode=aerwe1232","From: mail@mail.com\nReturn-Path: mail@mail.com");

Get my idea?
 
Last edited:
Back
Top