Help with an error? Parse error: syntax error, unexpected ';'

Status
Not open for further replies.

rbxlmadx

Member
Messages
32
Reaction score
1
Points
8
Page source:

http://rblxextra.x10.mx/Script/sources/welcome.php

Error on line 32.

Script:

<?php
function PageMain() {
global $TMPL;
global $confUrl;
global $confMail;
$resultSettings = mysql_fetch_row(mysql_query(getSettings($querySettings)));

$time = time()+86400;
$exp_time = time()-86400;

$TMPL_old = $TMPL; $TMPL = array();
$skin = new skin('welcome/form'); $form = '';
$TMPL['url'] = $confUrl;

if(loginCheck($_COOKIE['username'], $_COOKIE['password'])) {
header("Location: ".$confUrl."/index.php?a=me");
}

require_once('./includes/recaptchalib.php');

if($resultSettings[5] == 1) {
$TMPL['captcha'] = recaptcha_get_html($resultSettings[6]);
}

if(isset($_POST['register'])) {
if(!empty($_POST['regName']) && !empty($_POST['regPass']) && !empty($_POST['regEmail'])) {
if(strlen($_POST['regName']) >= 3 && strlen($_POST['regName']) <= 32) {
if(ctype_alnum($_POST['regName'])) {

if (filter_var($_POST['regEmail'], FILTER_VALIDATE_EMAIL)) {
$querySearch = sprintf("SELECT username from users where username = '%s'",
mysql_real_escape_string(strtolower($_POST['regName']));
$resultSearch = mysql_fetch_row(mysql_query($querySearch));
if (($_POST['regName']) == $resultSearch[0]) {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>This username already exists, please choose another one.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
} else {
if($resultSettings[5] == 1) {
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($resultSettings[7],
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if ($resp->is_valid) {
$createQuery = sprintf("INSERT into `users` (`username`, `password`, `email`) VALUES ('%s', '%s', '%s');",
mysql_real_escape_string(strtolower($_POST['regName'])),
md5(mysql_real_escape_string($_POST['regPass'])),
mysql_real_escape_string($_POST['regEmail']),
mysql_query($createQuery);

$username = $_POST['regName'];
$password = md5($_POST['regPass']);

setcookie("username", str_replace(' ', '', strtolower($username)), $time);
setcookie("password", $password, $time);
if($resultSettings[13] == '1') {
@sendMail($_POST['regEmail'], $resultSettings[0], $confUrl, $confMail, $_POST['regName'], $_POST['regPass']);
}


header("Location: ".$confUrl."/index.php?a=me");
}
}
}


else {
$createQuery = sprintf("INSERT into `users` (`username`, `password`, `email`, `date`) VALUES ('%s', '%s', '%s', '%s');",
mysql_real_escape_string(strtolower($_POST['regName'])),
md5(mysql_real_escape_string($_POST['regPass'])),
mysql_real_escape_string($_POST['regEmail']),
date("Y-m-d H:i:s");
mysql_query($createQuery);

$username = $_POST['regName'];
$password = md5($_POST['regPass']);

setcookie("username", str_replace(' ', '', strtolower($username)), $time);
setcookie("password", $password, $time);

if($resultSettings[13] == '1') {
@sendMail($_POST['regEmail'], $resultSettings[0], $confUrl, $confMail, $_POST['regName'], $_POST['regPass']);

}
header("Location: ".$confUrl."/index.php?a=me");
}
}
}
else {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>Invalid email format.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
}
}else {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>The username must contain only letters and numbers.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
}
}else {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>The username must be between 3 and 32 characters.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
}
}else {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>All fields must be completed.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
}
}

if(isset($_POST['login'])) {
$username = $_POST['username'];
$password = md5($_POST['password']);

setcookie("username", str_replace(' ', '', strtolower($username)), $time);
setcookie("password", $password, $time);

if(loginCheck($_POST['username'], md5($_POST['password']))) {
header("Location: ".$confUrl."/index.php?a=me");
} else {
$TMPL['message'] = '<div class="divider"></div>
<div class="notification-box notification-box-error">
<h5>Error!</h5>
<p>Invalid log-in credentials.</p>
<a href="#" class="notification-close notification-close-error">x</a>
</div>';
}
}
$form .= $skin->make();

$skin = new skin('welcome/latest'); $latest = '';

$queryLatest = "SELECT * FROM users WHERE image <> '' ORDER BY idu DESC LIMIT 14";
$resultLatest = mysql_query($queryLatest);

while($TMPL = mysql_fetch_assoc($resultLatest)) {

$TMPL['url'] = $confUrl;
$TMPL['image'] = (!empty($TMPL['image'])) ? '<img src="'.$confUrl.'/uploads/avatars/'.$TMPL['image'].'" width="64" height="64" />' : '<img src="http://www.gravatar.com/avatar/'.md5($TMPL['email']).'?s=64&d=mm" />';md5($result[3]);

$latest .= $skin->make();
}

$TMPL = $TMPL_old; unset($TMPL_old);
$TMPL['form'] = $form;
$TMPL['latest'] = $latest;

$TMPL['url'] = $confUrl;
$TMPL['title'] = 'Welcome - '.$resultSettings[0];

$TMPL['ad1'] = $resultSettings[2];
$TMPL['ad2'] = $resultSettings[3];

$skin = new skin('welcome/content');
return $skin->make();
}
?>





I do not know where I went wrong, can someone please help? It was working till I tried adding strtolower and editing things, must have added or deleted something and not seen it.
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi,

On line 32, you are missing a closed bracket. ;)

Code:
'%s'", mysql_real_escape_string(strtolower($_POST['regName'])));


Thank you,
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
You've forgot to close a function.
PHP:
$querySearch = sprintf("SELECT username from users where username = '%s'",
mysql_real_escape_string(strtolower($_POST['regName']));
should be...
PHP:
$querySearch = sprintf("SELECT username from users where username = '%s'",
mysql_real_escape_string(strtolower($_POST['regName'])));

EDIT: Well, it seems that @Dead-i is really a ninja. The page didn't tell me that someone had "newly" posted here in time. :rolleyes:
 
Last edited:
Status
Not open for further replies.
Top