Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Unexpected $ All brackets closed!! :(

Links for php scripts

Moderators: macek, egami, gesf

Unexpected $ All brackets closed!! :(

Postby radix » Sat Jul 05, 2003 6:53 am

Hi there, im trying to write a user registration process, but i keep coming up against this error, "Parse error: parse error, unexpected $ in /home/errosorg/public_html/inc/register_func.php on line 178"
Line 178 is the end of the script so i assumed that i hadnt closed off a curly bracket. ive checked and all seems well but i am totaly lost NE ideas greatly appreciated... oh and heres the code!

function user_register() {



global $supersecret_hash_padding;

//debug

$_SERVER='ikky1';
$user_name='bob';
$last_name='trev';
$email='s@a.bom';
$user_ip='192.168.0.3';
$first_name='danny';
$password='ikkyboy';





//are all vars present and paswords match?

if (strlen($_POST['user_name']) <= 25 && strlen($_POST['password1'])
<= 25 && ($_POST['password1'] == $_POST['password2']) &&
strlen($_POST['email']) <= 50 && validate_email($_POST['email'])) {
//validate un and pw
if (account_namevalid($_POST['user_name']) ||
strlen($_POST['password1'] >=6)) {
$user_name = strtolower($_POST['user_name']);
$user_name = trim($user_name);
$email = $_POST['email'];
//dont allow duplicate un or pw
$query = "SELECT id
FROM auth
WHERE un = '$user_name'
AND email = '$email'";
$result = mysql_query($query);

if ($result && mysql_num_rows($result) > 0) {
$feedback = 'ERROR - Username or email address already exists';
return $feedback;
}else{
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$password = md5($_POST['password1']);
$user_ip = $_SERVER['REMOTE_ADDR']; //check <-=
//create new hash to insert into DB and conf email
$hash = md5($email.$supersecret_hash_padding);
$query = "INSERT
INTO auth (un, 1st, last, pw, email, userIP, 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 confirmation email
$encoded_email = urlencode($_POST['email']);
$mail_body = <<< EOMAILBODY

Thankyou for registering at $sitevariable Click this link to confirm your registration //make the email an include file!
http://$sitevariable/inc/confirm.php?ha ... oded_email

Once you see a confirmation message, you will be logged into $sitevariable
EOMAILBODY;

mail ($email, $sitevariable, 'Registration confirmation',$mail_body, 'From: register@',$siteadd)

//if succcesful

$feedback = 'CONGRATULATIONS, YOU HAVE SUCCESSFULLY REGISTERED. You will recieve a confirmation email soon';
return $feedback;
}
}
}else{
$feedback = 'ERROR - Username or password is invalid';
return $feedback;
}
}else{
$feedback = 'ERROR - please fill all fields in correctly';
return $feedback;
}
}
radix
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Jul 05, 2003 6:47 am
Location: Cardiff uk

Re: Unexpected $ All brackets closed!! :(

Postby WiZARD » Mon Jul 07, 2003 6:09 am

where is it 178 string?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby Redcircle » Mon Jul 07, 2003 9:25 am

not sure if will help any but $_SERVER is a pre-defined super global array not a string as you are using it in the top of your code.

I don't believe you can set that var either.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby radix » Mon Jul 07, 2003 4:55 pm

Many thanks to those who tried to help but this is now fixed thanks!
radix
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Jul 05, 2003 6:47 am
Location: Cardiff uk

Postby WiZARD » Tue Jul 08, 2003 4:00 am

radix wrote:Many thanks to those who tried to help but this is now fixed thanks!

interesting that was a bug?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP Scripts

Who is online

Users browsing this forum: Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.