this is my register_functions include file code...
CORRECTION: Parse error: syntax error, unexpected '{'
Thats the error I get on line 104:
<?php
include_once('config.php');
$supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.';
function user_regester() {
global $supersecret_hash_padding;
//Are all VARS present and do passwords MATCH
if (strlen($_POST['user_name']) <= 25 &&
strlen($_POST['password1']) <= 25 && ($_POST['password1'] ==
$_POST['password2']) && strlen($_POST['email']) <= 50 &&
validate_email($_POST['email'])) {
//Validate UserName and PassWord
if(account_namevalid($_POST['user_name']) ||
strlen($_POST['password1'] >= 6 )) {
$user_name = strtolower($_POST['user_name']);
$user_name = trim($user_name);
$email = $_POST['email'];
$query = "SELECT user_id
FROM user
WHERE user_name = '$user_name'
AND email = '$email'";
$result = mysql_query($query);
if ($result && mysql_num_rows($result) > 0) {
$feedback = 'ERROR - - UserName and or EMAIL is already taken';
return $feedback;
} else {
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$password = md5($_POST['password1']);
$user_ip = $_SERVER['REMOTE_ADDR'];
//Create new HAST to insert into DB and the Conformation EMAIL
$hash = md5($email.$supersecret_hash_padding);
$query = "INSERT INTO user (user_name, first_name, last_name, password, email, remote_addr, confirm_hash, is_confirmed, date_created)
VALUES ('$user_name', '$first_name', '$last_name', '$password', '$email', '$user_ip', '$hash', '0', NOW())";
$result = mysql_query($query);
if (!$result) {
$feedback = 'ERROR - - Database ERROR';
return $feedback;
} else {
//Send Conformation EMAIL
$encoded_email = urlencode($_POST['email']);
$mail_body = <<< EOMAILBODY
Thank you for registering at www.okaucheewi.com! Click this link below to confirm registration.
http://localhost/confirm.php?hash=$hash$email=$encoded_email
Once you see a confirmation message, you will be logged into www.okacuheewi.com
EOMAILBODY;
mail ($email, 'OkaucheeWI Registration Confirmation' , $mail_body, 'FROM: noreply@okaucheewi.com');
// Give a successfull registration message
$feedback = 'YOU HAVE SUCCESSFULLY REGISTER. You will receive a confirmation email shortly';
return $feedback;
}
}
} else {
$feedback = 'ERROR - - UserName or PassWord Invalid';
return $feedback;
}
} else {
$feedback = 'ERROR - - Please fill in all required fields correctly';
return $feedback;
}
}
function account_namevalid() {
$span_str = "abcdefghijklmnopqrstuvwxyz" . "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-";
//Must have at least 1 character
if(strspn($_POST['user_name'],$span_str) == 0) {
return false;
}
//Must contain legal characters
if(strspn($_POST['user_name'],$span_str) != strlen($name)) {
return false;
}
//Min and Max Length
if (strlen($_POST['user_name']) <5) {
return false;
}
[B] if (strlen($_POST['user_name']) > 25 {
return false;
}[/B]
//Illegal names
if
(eregi("^((root) | (bin) | (daemon) | (adm) | (lp) | (sync) | (shutdown) |
(halt) | (mail) | (news) | (uucp) | (operator) | (games) | (mysql) |
(httpd) | (nobody) | (dummy) | (www) | (cvs) | (shell) | (ftp) | (irc) |
(debian) | (ns) | ( donwload))$", $_POST['user_name'])) {
return false;
}
if (eregi("^(anoncvs_)", $_POST['user_name'])) {
return false;
}
return false;
}
function validate_email() {
return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@' . '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $_POST['email']));
}
function user_confirm() {
global $supersecret_hash_padding;
//Verify no tampering with email address
$new_hash = md5($_GET['email'].$supersecret_hash_padding);
if ($new_hash && $new_hash == $_GET['hash'])) {
$query = "SELECT user_name
FROM user
WHERE confirm_hash = '$new_hash'";
$result = mysql_query($query);
if )!$result || mysql_num_rows($result) < 1) {
$feedback = 'ERROR - - Hash not found';
return $feedback;
} else {
//Confirm email and set account active
$email = $_GET['email'];
$hash = $_GET['hash'];
$query = "UPDATE user SET email ='$email', is_confirmed='1' WHERE confirm_hash = '$hash'";
$result = mysql_query($query);
return 1;
}
} else {
$feedback = 'ERROR - - Values do not match';
return $feedback;
}
}
?>