Jump to content

Need help pls:


ACwarrior

Recommended Posts

This is a registration page.

 

When i register and submit my detail in this progamme, i got this error msg...

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 8)' at line 8

 

 

My PHP programme:

 

$SUSPENDED = 8;

$sql = "INSERT INTO PHPAUCTION_users (id,

nick, password, name, country, nletter,email, reg_date,

rate_sum,  rate_num, birthdate,suspended)

      VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""

. md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""

. Addslashes ($TPL_name_hidden) . "\", \""

. AddSlashes ($TPL_country) . "\", \""

. AddSlashes ($TPL_nletter) . "\", \""

. AddSlashes ($TPL_email_hidden) . "\",

 

 

ANY ADVISE???????????

Link to comment
Share on other sites

Where is the rest of it, where you enter $SUSPENDED?

 

You have 12 fields but only 6 values.

 

 

This is a registration page.

 

When i register and submit my detail in this progamme, i got this error msg...

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 8)' at line 8

 

 

My PHP programme:

 

$SUSPENDED = 8;

$sql = "INSERT INTO PHPAUCTION_users (id,

nick, password, name, country, nletter,email, reg_date,

rate_sum,  rate_num, birthdate,suspended)

      VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""

. md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""

. Addslashes ($TPL_name_hidden) . "\", \""

. AddSlashes ($TPL_country) . "\", \""

. AddSlashes ($TPL_nletter) . "\", \""

. AddSlashes ($TPL_email_hidden) . "\",

 

 

ANY ADVISE???????????

Link to comment
Share on other sites

I have deleted a few fields

 

In the registration page, there are these fields to be entered

1.Your name   

2.Username   

3.Password 

4.Please, repeat your password   

5.Your e-mail address   

6.Country: 

7.Would you like to receive our Newsletter: Yes or No

 

Link to comment
Share on other sites

As below..the whole of my program.. thanks

 

*/
include "./includes/config.inc.php";

include "./includes/countries.inc.php";
include "./includes/checkage.inc.php";
$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);
$NOWB = date("Ymd",$TIME);
// --
if (!isset($_POST['auction_id']) && !isset($_GET['auction_id'])) {
$auction_id = $_SESSION["CURRENT_ITEM"];
} else {
$_SESSION["CURRENT_ITEM"]=$auction_id;
}

if (empty($_POST['action'])) {
$action = "first";
}

if ($_POST['action'] == "first") {
if (empty($TPL_name)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5029;
} elseif (empty($TPL_nick)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5030;
} elseif (empty($TPL_password)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5031;
} elseif (empty($TPL_repeat_password)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5032;
} elseif (empty($TPL_email)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5033;
} elseif (empty($TPL_country)) {
	$TPL_err = 1;
	$TPL_errmsg = $ERR_5037;


	if (strlen($TPL_nick) < 6) {
		$TPL_err = 1;
		$TPL_errmsg = $ERR_107;
	} else if (strlen ($TPL_password) < 6) {
		$TPL_err = 1;
		$TPL_errmsg = $ERR_108;
	} else if ($TPL_password != $TPL_repeat_password) {
		$TPL_err = 1;
		$TPL_errmsg = $ERR_109;
	} else if (strlen($TPL_email) < 5) { // Primitive mail check
	$TPL_err = 1;
	$TPL_errmsg = $ERR_110;
	} elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$", $TPL_email)) {
		$TPL_err = 1;
		$TPL_errmsg = $ERR_008;
	} else {
		$sql = "SELECT nick FROM PHPAUCTION_users WHERE nick=\"" . AddSlashes ($TPL_nick) . "\"";
		$res = mysql_query ($sql);
		if (mysql_num_rows($res) == 0) {
			$id = md5(uniqid(rand()));
			$id = eregi_replace("[a-f]", "", $id);

			$TPL_id_hidden = $id;
			$TPL_nick_hidden = $TPL_nick;
			$TPL_password_hidden = $TPL_password;
			$TPL_name_hidden = $TPL_name;
			$TPL_email_hidden = $TPL_email;
		} else {
			$TPL_err = 1;
			$TPL_errmsg = $ERR_111; // Selected user already exists
		}
		$sql = "SELECT email FROM PHPAUCTION_users WHERE email=\"" . AddSlashes ($TPL_email) . "\"";
		$res = mysql_query ($sql);
		if (mysql_num_rows($res) == 0) {
			$id = md5(uniqid(rand()));
			// $id = eregi_replace("[a-f]","",$id);
			$TPL_id_hidden = $id;
			$TPL_nick_hidden = $TPL_nick;
			$TPL_password_hidden = $TPL_password;
			$TPL_name_hidden = $TPL_name;
			$TPL_email_hidden = $TPL_email;
		} else {
			$TPL_err = 1;
			$TPL_errmsg = $ERR_115; // E-mail already used
		}

		if ($TPL_err == 0) {
			$TODAY = $NOWB;
			# // #################################################################
			# // Users suspended field
			# // VALUES:
			# // 		8 - no fee due, waiting for user's confirmation
			# //
			[b]$SUSPENDED = 8;[/b]
			$sql = "INSERT INTO PHPAUCTION_users (id,
					nick, password, name, country, nletter,email, reg_date,
					rate_sum,  rate_num,suspended)
			      	VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""
			. md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""
			. Addslashes ($TPL_name_hidden) . "\", \""
				. AddSlashes ($TPL_country) . "\", \""
				. AddSlashes ($TPL_nletter) . "\", \""
			. AddSlashes ($TPL_email_hidden) . "\",
				  '$TODAY',
				  0,
				  0,
				  '$DATE',
				  '$SUSPENDED')";
			$res = mysql_query ($sql);
			if ($res == 0) {
				$TPL_err = 1;
				$TPL_errmsg = mysql_error (); //"Error updating users data";
			} else {
				$TPL_id_hidden=mysql_insert_id();
				# // ===========================================================
				# // Added by Gian for IP banning
				# // Store user IP address in the database
				# // ===========================================================
				$query = "INSERT INTO PHPAUCTION_usersips VALUES(
						  NULL,
						  '$TPL_id_hidden',
						  '$REMOTE_ADDR',
						  'first','accept')";
				$res___ = @mysql_query($query);
				if (!$res___) {
					MySQLError($query);
					exit;
				}
				# // ===========================================================
				/**
				* Update column users in table PHPAUCTION_counters
				*/
				$query = "UPDATE PHPAUCTION_counters SET inactiveusers=inactiveusers+1";
				$counteruser = mysql_query($query);
				if (!$counteruser) {
					MySQLError($query);
					exit;
				}
				# // Send confirmation e-mail message depending on
				# // the signup confirmation settings
				include "includes/user_confirmation.inc.php";
			}
		} // if($TPL_err == 0)
	}
}
}

include "header.php";
if (($action == "first" && count($_POST) == 0) || ($_POST['action'] == "first" && $TPL_err)) {
$country = "";
foreach ($countries as $key=>$name) {
	$country .= "<option value=\"$name\"";
	if ($name == $TPL_country) {
		$country .= " selected";
	} elseif ($SETTINGS['defaultcountry'] == $name && !isset($TPL_err)) {
		$country .= " selected";
	}
	$country .= ">$name</option>\n";
}
include "templates/template_register_php.html";
}

if ($_POST['action'] == "first" && !$TPL_err) {
# //
include "templates/template_registered_php.html";
}
include "footer.php";
$TPL_err = 0;
$TPL_errmsg = "";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.