Parse error: syntax error, unexpected T_INCLUDE ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Parse error: syntax error, unexpected T_INCLUDE ??

Post by psychotomus »

wahts the problem. last line of the file is what gives me the error.

Code: Select all

<?
include("includes.php");

//set some post vars
$username = htmlspecialchars(str_replace("\'", "'", $_POST['textUsername']));
$email = htmlspecialchars(str_replace("\'", "'", $_POST['textEmail']));
$password = htmlspecialchars(str_replace("\'", "'", $_POST['textPassword']));
$gender = htmlspecialchars(str_replace("\'", "'", $_POST['gender']));
$month = htmlspecialchars(str_replace("\'", "'", $_POST['select']));
$day = htmlspecialchars(str_replace("\'", "'", $_POST['select2']));
$year = htmlspecialchars(str_replace("\'", "'", $_POST['select3']));
$country = htmlspecialchars(str_replace("\'", "'", $_POST['select4']));
$state = htmlspecialchars(str_replace("\'", "'", $_POST['textState']));
$zip = htmlspecialchars(str_replace("\'", "'", $_POST['textZip']));

//generate a verification code
$code = rand(2,999999999);
$dob = mktime(0,0,0, $month, $day, $year);

//subscriptions
$subscriptions = array();
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox2']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox3']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox4']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox5']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox6']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox7']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox8']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox9']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox10']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox11']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox12']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox13']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox14']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox15']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox16']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox17']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox18']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox19']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox20']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox21']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox22']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox23']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox24']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox25']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox26']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox27']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox28']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox29']));
$subscriptions[] = htmlspecialchars(str_replace("\'", "'", $_POST['checkbox30']));

//set subscriptions to no, if not set to yes
for($i=0;$i<count($subscriptions);$i++)
	if ($subscriptions[$i] <> "y")
		$subscriptions[$i] = "n";

//check if username is of valid characters


//username, email and password not blank
if (!empty($username) && !empty($email) && !empty($password))
{

	//check if username or email not allready in use
	$query = mysql_query("SELECT id FROM users WHERE (username='$username' OR user_email='$email')") or die(mysql_error());
	$info = mysql_fetch_object($query);
	//username or email not taken
	if ($info->id == "")
	{

		$query="INSERT INTO users (
				username,
				user_pass,
				user_email,
				user_verified,
				user_rank,
				user_gender,
				user_country,
				user_state,
				user_zip,
				user_dob,
				user_join_date
		) VALUES (
				'".$username."',
				'".$password."',
				'".$email."',
				'".$code."',
				'0',
				'".$gender."',
				'".$country."',
				'".$state."',
				'".$zip."',
				'".$dob."',
				'".time()."'
				)";
		mysql_query($query) or die(mysql_error());


		$query="INSERT INTO user_settings (
				username,
				popup_on_new_msg,
				email_on_new_msg,
				popup_on_lost_highscore,
				email_on_lost_highscore,
				popup_friend_invite,
				email_friend_invite,
				play_profile_music,
				daily_anime,
				daily_manga,
				daily_poetry,
				daily_fanfiction,
				daily_gaming,
				daily_comics,
				daily_midis,
				daily_mp3s,
				daily_horoscopes,
				daily_jokes,
				weekly_anime,
				weekly_manga,
				weekly_poetry,
				weekly_fanfiction,
				weekly_gaming,
				weekly_comics,
				weekly_midis,
				weekly_mp3s,
				weekly_horoscopes,
				weekly_jokes,
				monthly_anime,
				monthly_manga,
				monthly_poetry,
				monthly_fanfiction,
				monthly_gaming,
				monthly_comics,
				monthly_midis,
				monthly_mp3s,
				monthly_horoscopes,
				monthly_jokes
		) VALUES (
				'$username',
				'y',
				'y',
				'y',
				'y',
				'y',
				'y',
				'y',
				'".$subscriptions[0]."',
				'".$subscriptions[1]."',
				'".$subscriptions[2]."',
				'".$subscriptions[3]."',
				'".$subscriptions[4]."',
				'".$subscriptions[5]."',
				'".$subscriptions[6]."',
				'".$subscriptions[7]."',
				'".$subscriptions[8]."',
				'".$subscriptions[9]."',
				'".$subscriptions[10]."',
				'".$subscriptions[11]."',
				'".$subscriptions[12]."',
				'".$subscriptions[13]."',
				'".$subscriptions[14]."',
				'".$subscriptions[15]."',
				'".$subscriptions[16]."',
				'".$subscriptions[17]."',
				'".$subscriptions[18]."',
				'".$subscriptions[19]."',
				'".$subscriptions[20]."',
				'".$subscriptions[21]."',
				'".$subscriptions[22]."',
				'".$subscriptions[23]."',
				'".$subscriptions[24]."',
				'".$subscriptions[25]."',
				'".$subscriptions[26]."',
				'".$subscriptions[27]."',
				'".$subscriptions[28]."',
				'".$subscriptions[29]."'
				)";
		mysql_query($query) or die("There was an error during registration. Your account was created; however, your subscriptions was not set. Please CONTACT AN ADMIN!");
		
		echo 'registration complete';
	}
	else
	{
		$eRR= 'username allready taken';
	}
}
//username email or password is blank
else
{

	if (empty($username))
		$eRR = "Username not set...<br>";
	if (empty($emai))
		$eRR .= "Email address not set...<br>";
	if (empty($password))
		$eRR .= "Password not set...<br>";

}

if (!empty($eRR))
	include("register.php");
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I get no parse error.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

volka wrote:I get no parse error.
I do =(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You should probably be passing getrandmax() to rand() instead of 999,999,999 as it's likely a bit high.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

i'll lower that # to 999999.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

why don't you tell us what the error is?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

visitor-Q wrote:why don't you tell us what the error is?
Maybe
Parse error: syntax error, unexpected T_INCLUDE ??
?
Post Reply