Forum Moderators: coopster

Message Too Old, No Replies

Parse error: parse error, unexpected T STRING,

how to solve it?

         

Lambkins

5:16 am on May 2, 2009 (gmt 0)

10+ Year Member



Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /agb/index.php on line 674

I am getting this massage for some days. Last week my guestbook worked just fine and I didn't change anything since than. I am not a pro in PHP so please help me to solve the problem.

My line 674 looks like:
?><!-- o65 --><!-- c65 --><?php echo ''; ?><?php echo '<Script Language='Javascript'>

Thnx

homeless

5:27 am on May 2, 2009 (gmt 0)

10+ Year Member



try to encase the javascript in double quotes

or

escape (\') the the single quotes in the javascript so they are not interpreted as delimiters.

<?php echo "<Script Language='Javascript'>"; ?>

Lambkins

6:57 am on May 2, 2009 (gmt 0)

10+ Year Member



Thnx
I will try to fix it tomorrow. I hope it will work.

eeek

7:37 am on May 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<!-- o65 --><!-- c65 --><?php echo ''; ?><?php echo '<Script Language="Javascript">';

Lambkins

4:25 am on May 3, 2009 (gmt 0)

10+ Year Member



I forgot to put the whole code.

?><!-- o65 --><!-- c65 --><?php echo ''; ?><?php echo '<Script Language='Javascript'>
<!--
document.write(unescape('<malicious url-encoded iframe string here>'));
//-->
</Script>'; ?>

I did everything that HOMELESS told me and it worked. I corrected a lot of php files but at the end my guestbook was not working like it did before. The funny thing is that it worked last week with old code and nobody changed anything. And now is not working. Why is it not working now?

[edited by: coopster at 11:55 am (utc) on May 4, 2009]
[edit reason] removed malicious encoded url [/edit]

homeless

5:17 am on May 3, 2009 (gmt 0)

10+ Year Member



Hi Lambkins,

You don't want to start changing a bunch of files, unless they are throwing errors.

You just need to understand that programming languages have delimiters. PHP has double quotes and single quotes. Your code will not work because PHP and Javascript are using the same delimiters (single quotes). Since PHP is writing the JavaScript it cannot determine where the string ends.

I'm assuming this Javascripts was not part of the orignal code...mainly because of the 2 "echo"'s. It looks like someone may be trying to add these in.

?><!-- o65 --><!-- c65 --><?php echo ''; ?><?php echo "<Script Language='Javascript'>
<!--
document.write(unescape('<malicious url-encoded iframe string here>'));
//-->

[edited by: coopster at 11:54 am (utc) on May 4, 2009]
[edit reason] removed malicious encoded url [/edit]

Lambkins

12:42 am on May 4, 2009 (gmt 0)

10+ Year Member



You are right. Someone tried to add this. I have send my php to some people and they figured out that someone wanted to hack my server and add some #*$! sites to the php code. I overwrited with old php file and now works fine. I need to learn a lot about php

Lambkins

12:44 am on May 4, 2009 (gmt 0)

10+ Year Member



Thank you guys for help