Question
PHP registration script not working
here is my code:
<?
//prevents caching
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();
session_start();
//require the config file
require ("../includes/config.php");
require ("../includes/functions.php");
require ("../includes/sessions.php");
//checks password length
if (password_check($min_pass, $max_pass, $_POST[password]) == "no")
{
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="0; url=javascript:history.go(-1)">
<title>Registration</title>
<script language="JavaScript">
<!--
function FP_popUpMsg(msg) {//v1.0
alert(msg);
}
// -->
</script>
</head>
<body onLoad="FP_popUpMsg('Your password must be between <? echo $min_pass; ?> & <? echo $max_pass; ?> characters.')">
</body>
</html>
<?php
exit;
}
//make the connection to the database
$connection = @6688122_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @6688122_select_db($db_name,$connection)or die(mysql_error());
//make query to database
$sql ="SELECT * FROM $table_users WHERE usr_username = '$_POST[username]'";
$result = @6688122_query($sql,$connection) or die(mysql_error());
//get the number of rows in the result set
$num = mysql_num_rows($result);
//checks it see if that username already exists
if ($num != 0){
echo "<P>Sorry, that username already exists.</P>";
echo "<P><a href=\"#\" onClick=\"history.go(-1)\">Try Another Username.</a></p>";
exit;
}else{
$sql = "INSERT INTO $table_users VALUES
('', '$_POST[name]', '$_POST[address]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[username]', password('$_POST[password]', '$_POST[email]', '$_POST[verified]', '$_POST[date]', '$_POST[phone]', '$_POST[cell]', '$_POST[fax]', '$_POST[group]', '$_POST[memid]')"
$result = @6688122_query($sql,$connection) or die(mysql_error())
}
//checks to see if the user needs to verify their email address before accessing the site
if ($verify == "0")
{
$mailheaders = "From: www$domain\n";
$mailheaders .= "Your account has been created.\n";
$mailheaders .= "Please activate your account now by visiting this page:\n";
$mailheaders .= "$base_dir/activate.html\n";
$to = "$_POST[email]";
$subject = "Please activate your account";
mail($to, $subject, $mailheaders, "From: No Reply <$adminemail>\n");
}else{
header('Location:users.php?message=adduser');
}
?>
and here is the error I am getting:
Parse error: syntax error, unexpected T_VARIABLE in /home/pcl/public_html/admin/register.php on line 66
This is the place where I insert the variables into the database. I can not figure out why this script gets an error, any assistance is greatly appriciated.
<?
//prevents caching
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();
session_start();
//require the config file
require ("../includes/config.php");
require ("../includes/functions.php");
require ("../includes/sessions.php");
//checks password length
if (password_check($min_pass, $max_pass, $_POST[password]) == "no")
{
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="0; url=javascript:history.go(-1)">
<title>Registration</title>
<script language="JavaScript">
<!--
function FP_popUpMsg(msg) {//v1.0
alert(msg);
}
// -->
</script>
</head>
<body onLoad="FP_popUpMsg('Your password must be between <? echo $min_pass; ?> & <? echo $max_pass; ?> characters.')">
</body>
</html>
<?php
exit;
}
//make the connection to the database
$connection = @6688122_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @6688122_select_db($db_name,$connection)or die(mysql_error());
//make query to database
$sql ="SELECT * FROM $table_users WHERE usr_username = '$_POST[username]'";
$result = @6688122_query($sql,$connection) or die(mysql_error());
//get the number of rows in the result set
$num = mysql_num_rows($result);
//checks it see if that username already exists
if ($num != 0){
echo "<P>Sorry, that username already exists.</P>";
echo "<P><a href=\"#\" onClick=\"history.go(-1)\">Try Another Username.</a></p>";
exit;
}else{
$sql = "INSERT INTO $table_users VALUES
('', '$_POST[name]', '$_POST[address]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[username]', password('$_POST[password]', '$_POST[email]', '$_POST[verified]', '$_POST[date]', '$_POST[phone]', '$_POST[cell]', '$_POST[fax]', '$_POST[group]', '$_POST[memid]')"
$result = @6688122_query($sql,$connection) or die(mysql_error())
}
//checks to see if the user needs to verify their email address before accessing the site
if ($verify == "0")
{
$mailheaders = "From: www$domain\n";
$mailheaders .= "Your account has been created.\n";
$mailheaders .= "Please activate your account now by visiting this page:\n";
$mailheaders .= "$base_dir/activate.html\n";
$to = "$_POST[email]";
$subject = "Please activate your account";
mail($to, $subject, $mailheaders, "From: No Reply <$adminemail>\n");
}else{
header('Location:users.php?message=adduser');
}
?>
and here is the error I am getting:
Parse error: syntax error, unexpected T_VARIABLE in /home/pcl/public_html/admin/register.php on line 66
This is the place where I insert the variables into the database. I can not figure out why this script gets an error, any assistance is greatly appriciated.
