EDIT~~~
ok after all that work... i cant embed the file ¬¬ halls sort it out boy :p
hopfully this link will redirect you lol.
[vimeo]http://vimeo.com/5931700[/vimeo]
is my 1st tutorial. Im not the greatest at explaining things. but have done my best. Source code for the 'php' parsing script and the 'activation' page is as follows.
register.php...
Code: Select all
<?php
if (isset ($_POST['username'])){
$username = $_POST['username'];
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$humancheck = $_POST['humancheck'];
$username = stripslashes($username);
$email1 = stripslashes($email1);
$email2 = stripslashes($email2);
$pass1 = stripslashes($pass1);
$pass2 = stripslashes($pass2);
$username = strip_tags($username);
$email1 = strip_tags($email1);
$email2 = strip_tags($email2);
$pass1 = strip_tags($pass1);
$pass2 = strip_tags($pass2);
include_once "*connection script name/location*";
$emailChecker = mysql_real_escape_string($email1);
$emailChecker = eregi_replace("`", "", $emailChecker);
$usernameChecker = mysql_real_escape_string($username);
$usernameChecker = eregi_replace("`", "", $usernameChecker);
$sql_email_check = mysql_query("SELECT email FROM *table name* WHERE email='$emailChecker'");
$email_check = mysql_num_rows($sql_email_check);
$sql_username_check = mysql_query("SELECT email FROM *table name* WHERE username='$usernameChecker'");
$username_check = mysql_num_rows($sql_username_check);
if ((!$username) || (!$email1) || (!$email2) || (!$pass1) || (!$pass2)) {
$errorMsg = "ERROR: Missing Vital Information:<br /><br />";
if(!$username){
$errorMsg .= " * Username<br />";
}
if(!$pass1){
$errorMsg .= " * Password<br />";
}
if(!$pass2){
$errorMsg .= " * Confirm Password<br />";
}
if(!$email1){
$errorMsg .= " * Email<br />";
}
if(!$email2){
$errorMsg .= ' * Confirm Email<br />';
}
}
else if ($email1 != $email2) {
$errorMsg = 'ERROR: Email Fields Mis Matched.<br />';
} else if ($pass1 != $pass2) {
$errorMsg = 'ERROR: Password Fields Mis Matched.<br />';
} else if ($humancheck != "") {
$errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human.<br />';
} else if ($email_check > 0){
$errorMsg = "<u>ERROR:</u><br />Your Email Is Already Registered.<br />";
} else if ($username_check > 0){
$errorMsg = "<U>ERROR:</u>Username Already In Use.<br>";
} else {
$username = mysql_real_escape_string($username);
$pass1 = mysql_real_escape_string($pass1);
$email1 = mysql_real_escape_string($email1);
$username = eregi_replace("`", "", $username);
$pass1 = eregi_replace("`", "", $pass1);
$email1 = eregi_replace("`", "", $email1);
$db_password = md5($pass1);
$sql = mysql_query("INSERT INTO *table name* (username, password, email, sign_up_date)
VALUES('$username','$db_password','$email1', now())")
or die (mysql_error());
$id = mysql_insert_id();
mkdir("members/$id", 0755);
$to = "$email1";
$from = "admin@*your domain*.com";
$subject = "Complete Netrix Network registration";
//Begin HTML Email Message
$message = "Hi $username,
Complete this step to activate your login identity at *your game*.
Click the line below to activate when ready.
http://www.*your domain*.com/activation.php?id=$id&sequence=$db_password
If the URL above is not an active link, please copy and paste it into your browser address bar
Login after successful activation using your:
Username: $username
Password: $pass1
See you on the site!
admin@*your domain*.com";
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
$msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $username, one last step to verify your email identity:</h4><br />
In a moment you will be sent an Activation link to your email address.<br /><br />
<br />
<strong><font color=\"#990000\">VERY IMPORTANT:</font></strong>
If you check your email with your host providers default email application, there may be issues with seeing the email contents. If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
";
include_once 'msgToUser.php';
exit();
}
}else{
$errorMsg = "Fields marked with an [ * ] are required";
$username = "";
$pass1 = "";
$pass2 = "";
$email1 = "";
$email2 = "";
}
?>
activation.php...
Code: Select all
<?php
if ($_GET['id'] != "") {
include_once "*connection script name/location*";
$id = $_GET['id'];
$hashpass = $_GET['sequence'];
$id = mysql_real_escape_string($id );
$id = eregi_replace("`", "", $id);
$hashpass = mysql_real_escape_string($hashpass);
$hashpass = eregi_replace("`", "", $hashpass);
$sql = mysql_query("UPDATE *table name* SET email_activated='1' WHERE id='$id' AND password='$hashpass'");
$sql_doublecheck = mysql_query("SELECT * FROM *table name* WHERE id='$id' AND password='$hashpass' AND email_activated='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck == 0){
$msgToUser = "<br /><br /><h3><strong><font color=red>Your account could not be activated!</font></strong><h3><br />
<br />
Please email site administrator and request manual activation.
";
include 'msgToUser.php';
exit();
} elseif ($doublecheck > 0) {
$msgToUser = "<br /><br /><h3><font color=\"#0066CC\"><strong>Your account has been activated! <br /><br />
Return to the main page to log in.</strong></font></h3>";
include 'msgToUser.php';
exit();
}
}
print "Essential data from the activation URL is missing! Close your browser, go back to your email inbox, and please use the full URL supplied in the activation link we sent you.<br />
<br />
admin@*your domain*.com
";
?>
In a few i will be posting the addittions i done after the video.
LUBS xxx