Jump to content

unexpected T_LOGICAL_OR Error in script

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Skillz

Skillz

    Newbie

  • Members
  • Pip
  • 9 posts
Ok, this script is pretty basic. What it will do is FTP to a server and gather files (logs) and transfer them back to the web server. Seems simple enough.

It specifically searches for a special type of log, that begins with a certain string. I want to add another option so that it will search for another certain string. Basically, they are logs created by a cheat protection on a gaming server.

The script is already configured to work with UTDC, which is one type of cheat protection. I want to add it to also parse logs for AnthChecker too. which is another cheat protection.

UTDC logs begin with [UTDC] and AnthChecker logs begin with [AC], so adding this souldn't be too hard.

Basically what I have done is copied all of the UTDC things and just replaced UTDC with AC where applicable. (I am adding this on, not replacing) So basically UTDC still needs to work.

I have everything setup, except the auto transfer part. This is where I am stuck: (Only part of the file, parts that I edited)


			foreach ($filelist as $filename) {


				if ((substr($filename, strlen($filename) - strlen($import_log_extension)) == $import_log_extension)


				or ($import_utdc_download_enable and substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension))

				or ($import_ac_download_enable and substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension))				{


				} else {


					continue;


				}


				if ((substr($filename, 0, strlen($import_log_start)) == $import_log_start)	


				or ($import_utdc_download_enable and substr($filename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start)) 

				or ($import_ac_download_enable and substr($filename, 0, strlen($import_ac_log_start)) == $import_ac_log_start)){


				} else {


					continue;


				}

This is the error I get when I try to run the script to get the files.
Parse error: syntax error, unexpected T_LOGICAL_OR in /home/utstats/public_html/utstats/includes/ftp.php on line 252

Here is the unedited portion of that script:
			foreach ($filelist as $filename) {


				if ((substr($filename, strlen($filename) - strlen($import_log_extension)) == $import_log_extension)


				or ($import_utdc_download_enable and substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension)){


				} else {


					continue;


				}


				if ((substr($filename, 0, strlen($import_log_start)) == $import_log_start)	


				or ($import_utdc_download_enable and substr($filename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start)){


				} else {


					continue;


				}

As you can see, I took all instances of utdc and just duplicated it with ac, I am guessing that method I took is incorrect, since I obviously got an error with it.

Any help will be appreciated.

#2
Skillz

Skillz

    Newbie

  • Members
  • Pip
  • 9 posts
Nevermind, I fixed it.

foreach ($filelist as $filename) {


				if ((substr($filename, strlen($filename) - strlen($import_log_extension)) == $import_log_extension)


				or ($import_utdc_download_enable and substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension)

				

				or ($import_ac_download_enable and substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension)){


				} else {


					continue;


				}


				if ((substr($filename, 0, strlen($import_log_start)) == $import_log_start)	


				or ($import_utdc_download_enable and substr($filename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start) 

				

				or ($import_ac_download_enable and substr($filename, 0, strlen($import_ac_log_start)) == $import_ac_log_start)){


				} else {


					continue;


				}

Not sure if that's proper though.