Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript
Author Message
rickleigh
Worker
Worker



Joined: Jan 06, 2009
Posts: 183

PostPosted: Thu Aug 13, 2009 7:00 pm Reply with quote

I have installed the LiveZilla freeware support system on my RavenNuke site. The system comes with a JavaScript to track your visitors.

Now...I have the script embedded in my stand alone Classifieds and ZenCart which are ran from Sub Directories and is working like it should. But, when I put it in my RN2.3 site it comes up with the following error on the bottom left of IE after loading:

Code:
Webpage error details


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Timestamp: Wed, 12 Aug 2009 21:38:38 UTC


Message: Object expected
Line: 1
Char: 1
Code: 0
URI: http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse=0.11006134724575894


The JavaScript that was given to us is:
Code:
<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><script language="JavaScript" type="text/javascript">

<!-- DON'T REMOVE ANY LINE BREAKS-->
<!--
var script = document.createElement("script");script.type="text/javascript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);
// -->
</script><!-- http://www.LiveZilla.net Tracking Code -->


Is there something in the nuke code that would be blocking this script from being able to function right?

_________________
Thanks,
Rick Leigh 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Fri Aug 14, 2009 3:43 am Reply with quote

Thats a JS error. You have used the <head> and <body> tags more than once, which can break JS that depends on the body to finish loading. There are many other validations errors, any of which could be causing the problem.

Try using a code validation service such as [ Only registered users can see links on this board! Get registered or login! ] or the tidy html validator addon for firefox.
 
View user's profile Send private message Visit poster's website
rickleigh







PostPosted: Fri Aug 14, 2009 2:36 pm Reply with quote

How can I embed this code:
Code:
<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><script language="JavaScript" type="text/javascript"> 

<!-- DON'T REMOVE ANY LINE BREAKS-->
<!--
var script = document.createElement("script");script.type="text/javascript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);
// -->
</script><!-- http://www.LiveZilla.net Tracking Code -->
so that all pages are tracked? Maybe in the header.php but, I'm not sure where to put it and how to code it.
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Sat Aug 15, 2009 10:36 am Reply with quote

How are you trying to add it?

Try adding it in the preferences section of the admin control panel. Switch the editor to source and paste the code.

This works for the Google Analytics code.
 
View user's profile Send private message
rickleigh







PostPosted: Sat Aug 15, 2009 8:39 pm Reply with quote

jakec wrote:
How are you trying to add it?

Try adding it in the preferences section of the admin control panel. Switch the editor to source and paste the code.

This works for the Google Analytics code.


I tried that and I get the error I stated in my fisrt post. Man this code is being a pain in my butt Evil or Very Mad It works fine in my stand alone ZenCart and Classifieds area of the site. It only throws an error in the RN pages Confused
 
spasticdonkey







PostPosted: Sun Aug 16, 2009 4:32 am Reply with quote

I'm pretty sure unless you fix some of the major errors in the page you will continue to have issues, no matter where you put the code.

Image

at least fix the <body> and <head> issue, those tags should only be used once per page.

btw it works ok in firefox, more tolerant of the errors...
 
rickleigh







PostPosted: Sun Aug 16, 2009 9:21 am Reply with quote

So I take the theme I chose to use wasn't made right? I was unaware that there were so many errors as it has always loaded right.
 
spasticdonkey







PostPosted: Sun Aug 16, 2009 10:10 am Reply with quote

well the theme might not be that bad off, some of the errors will compound themselves. Looks like the code added to fade the header images maybe included a little too much. Try adding this to includes/javascript.php before ?>
Notice I changed script to s cript, fix that Smile

Code:
echo '<s cript type="text/javascript" src="themes/ClanMtS/FADE.JS"></s cript>'."\n";

echo '<s cript type="text/javascript">'."\n";
echo '<!--'."\n";
echo 'function newImage(arg) {'."\n";
echo '   if (document.images) {'."\n";
echo '      rslt = new Image();'."\n";
echo '      rslt.src = arg;'."\n";
echo '      return rslt;'."\n";
echo '   }'."\n";
echo '}'."\n\n";
echo 'function changeImages() {'."\n";
echo '   if (document.images && (preloadFlag == true)) {'."\n";
echo '      for (var i=0; i<changeImages.arguments.length; i+=2) {'."\n";
echo '         document[changeImages.arguments[i]].src = changeImages.arguments[i+1];'."\n";
echo '      }'."\n";
echo '   }'."\n";
echo '}'."\n\n";
echo 'var preloadFlag = false;'."\n";
echo 'function preloadImages() {'."\n";
echo '   if (document.images) {'."\n";
echo '      ClanMts_hd_02_ClanMts_hd_13_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_02-ClanMts-hd_13.gif");'."\n";
echo '      ClanMts_hd_02_ClanMts_hd_11_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_02-ClanMts-hd_11.gif");'."\n";
echo '      ClanMts_hd_11_ClanMts_hd_13_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_11-ClanMts-hd_13.gif");'."\n";
echo '      ClanMts_hd_11_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_11-over.gif");'."\n";
echo '      ClanMts_hd_12_ClanMts_hd_13_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_12-ClanMts-hd_13.gif");'."\n";
echo '      ClanMts_hd_12_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_12-over.gif");'."\n";
echo '      ClanMts_hd_12_ClanMts_hd_11_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_12-ClanMts-hd_11.gif");'."\n";
echo '      ClanMts_hd_13_ClanMts_hd_14_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_13-ClanMts-hd_14.gif");'."\n";
echo '      ClanMts_hd_13_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_13-over.gif");'."\n";
echo '      ClanMts_hd_13_ClanMts_hd_12_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_13-ClanMts-hd_12.gif");'."\n";
echo '      ClanMts_hd_14_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_14-over.gif");'."\n";
echo '      ClanMts_hd_15_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_15-over.gif");'."\n";
echo '      ClanMts_hd_15_ClanMts_hd_14_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_15-ClanMts-hd_14.gif");'."\n";
echo '      ClanMts_hd_16_ClanMts_hd_15_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_16-ClanMts-hd_15.gif");'."\n";
echo '      ClanMts_hd_17_ClanMts_hd_15_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_17-ClanMts-hd_15.gif");'."\n";
echo '      ClanMts_hd_17_ClanMts_hd_14_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_17-ClanMts-hd_14.gif");'."\n";
echo '      ClanMts_hd_17_ClanMts_hd_13_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_17-ClanMts-hd_13.gif");'."\n";
echo '      ClanMts_hd_17_ClanMts_hd_12_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_17-ClanMts-hd_12.gif");'."\n";
echo '      ClanMts_hd_17_ClanMts_hd_11_over = newImage("themes/ClanMtS/images/header/ClanMts-hd_17-ClanMts-hd_11.gif");'."\n";
echo '      preloadFlag = true;'."\n";
echo '   }'."\n";
echo '}'."\n\n";
echo '// -->'."\n";
echo '</S CRIPT>'."\n";


and remove however you added that scripting before. That might fix your other error with the livesupport script in itself. As far as the other errors many are not too hard to fix.
These won't usually cause layout of script problems, but in xhtml,
<br> should be <br />
<hr> should be <hr />
<img src="someimage.jpg"> should be <img src="someimage.jpg" />

you can also create a custom header file to load your scripts, you'll have to search the forums for that Smile
 
rickleigh







PostPosted: Sun Aug 16, 2009 4:28 pm Reply with quote

Well...I put the fade script in the Javascript.php file like you said and still no luck on getting the livesupport script to work. I'm tring to look and figure out the /> errors one by one as I'm still learning php coding. Thanks for helping on this and if you can think of anything for me to look for in my theme that would deny the support tracking code let me know.

Thanks
 
rickleigh







PostPosted: Sun Aug 16, 2009 5:23 pm Reply with quote

Ok.. I did a simple test and loaded RN's fisubice theme to see if the issue with this LiveZilla tracking script was being messed with because of the theme I was using.

The same error happens no matter what theme I use. So this tells me that its something to do with the script not working well with the RN core coding.

Any new ideas from this new info would be appreciated Wink
 
jakec







PostPosted: Mon Aug 17, 2009 5:01 am Reply with quote

Are you able to view source? Just wondering if any of the tracking code is being stripped out?

If it is an alternative may be to add a custom_footer.php file with the code in and copy it to your includes/custom_files directory on the server.
 
rickleigh







PostPosted: Mon Aug 17, 2009 10:09 am Reply with quote

jakec wrote:

If it is an alternative may be to add a custom_footer.php file with the code in and copy it to your includes/custom_files directory on the server.


This corrected the error and has let the tracking script work like it should Exclamation Exclamation Very Happy

But.... It has caused another issue. Now when I try and go to my admin area it gives me a page error.

Error 401
The request needs user authentication


So it acts like its not allowing for the popup that ask for my User name & PW. Is there something I need to put in the custom file other then the script code?

Here is the code as I have it now:
Code:
<?php


<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><s cript language="JavaS cript" type="text/javas cript">
<!-- DON'T REMOVE ANY LINE BREAKS-->
<!--
var s cript = document.createElement("s cript");s cript.type="text/javas cript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("s cript.src=src;document.getElementById('livezilla_tracking').appendChild(s cript)",1);
// -->
</s cript><!-- http://www.LiveZilla.net Tracking Code -->
?>

I spaced "script" like S cript for this post so that it didnt block me as some forums do Wink
I'm also getting this in my log file:
PHP Parse error: syntax error, unexpected '<'
 
rickleigh







PostPosted: Mon Aug 17, 2009 1:03 pm Reply with quote

I think I need to echo the script. Can anyone help me echo this the correct way so that it will correct the syntax error and tell me if this would also make it to where I get the issue with not allowing my user/pw for the admin section as I stated above?
 
rickleigh







PostPosted: Mon Aug 17, 2009 5:40 pm Reply with quote

Anyone? Wink
 
spasticdonkey







PostPosted: Mon Aug 17, 2009 6:47 pm Reply with quote

try this
Code:
echo '<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><s cript language="JavaS cript" type="text/javas cript">'."\n"; 

echo '<!-- DON\'T REMOVE ANY LINE BREAKS-->'."\n";
echo '<!--'."\n";
echo 'var s cript = document.createElement("s cript");s cript.type="text/javas cript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("s cript.src=src;document.getElementById(\'livezilla_tracking\').appendChild(s cript)",1);'."\n";
echo '// -->'."\n";
echo '</s cript><!-- http://www.LiveZilla.net Tracking Code -->'."\n";
 
rickleigh







PostPosted: Mon Aug 17, 2009 7:48 pm Reply with quote

spasticdonkey wrote:
try this
Code:
echo '<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><s cript language="JavaS cript" type="text/javas cript">'."\n"; 

echo '<!-- DON\'T REMOVE ANY LINE BREAKS-->'."\n";
echo '<!--'."\n";
echo 'var s cript = document.createElement("s cript");s cript.type="text/javas cript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("s cript.src=src;document.getElementById(\'livezilla_tracking\').appendChild(s cript)",1);'."\n";
echo '// -->'."\n";
echo '</s cript><!-- http://www.LiveZilla.net Tracking Code -->'."\n";


Nope, didnt work:(

I get this in the log file:PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
 
rickleigh







PostPosted: Tue Aug 18, 2009 3:04 pm Reply with quote

rickleigh wrote:

This corrected the error and has let the tracking script work like it should Exclamation Exclamation Very Happy

But.... It has caused another issue. Now when I try and go to my admin area it gives me a page error.

Error 401
The request needs user authentication


So it acts like its not allowing for the popup that ask for my User name & PW. Is there something I need to put in the custom file other then the script code?

Here is the code as I have it now:
Code:
<?php


<!-- http://www.LiveZilla.net Tracking Code --><div id="livezilla_tracking" style="display:none"></div><s cript language="JavaS cript" type="text/javas cript">
<!-- DON'T REMOVE ANY LINE BREAKS-->
<!--
var s cript = document.createElement("s cript");s cript.type="text/javas cript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("s cript.src=src;document.getElementById('livezilla_tracking').appendChild(s cript)",1);
// -->
</s cript><!-- http://www.LiveZilla.net Tracking Code -->
?>

I spaced "script" like S cript for this post so that it didnt block me as some forums do Wink
I'm also getting this in my log file:
PHP Parse error: syntax error, unexpected '<'

Still looking for help on this please;)
 
wHiTeHaT
Life Cycles Becoming CPU Cycles



Joined: Jul 18, 2004
Posts: 579

PostPosted: Tue Aug 18, 2009 3:38 pm Reply with quote

put your code that worked around this:

Code:
if (!defined('ADMIN_FILE')) {


*******your code***********
}


If you used plain javascript do:

Code:


if (!defined('ADMIN_FILE')) {
?>
*******your code***********
<?php
}


Wink
 
View user's profile Send private message Send e-mail
rickleigh







PostPosted: Tue Aug 18, 2009 4:34 pm Reply with quote

Now I get this error in the log:PHP Parse error: syntax error, unexpected '}'

Here is my code:

Code:
if (!defined('ADMIN_FILE')) {

?>
echo '<!-- http://www.LiveZilla.net Tracking Code -->'."\n";
echo '<div id="livezilla_tracking" style="display:none"></div><script language="JavaScript" type="text/javascript">'."\n";
echo '<!-- DON'T REMOVE ANY LINE BREAKS-->'."\n";
echo '<!--'."\n";
echo 'var script = document.createElement("script");script.type="text/javascript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);'."\n";
echo '// -->'."\n";
echo '</script>'."\n";
echo '<!-- http://www.LiveZilla.net Tracking Code -->'."\n";
<?php
}


Is this correct? I've tried it both ways Wink
 
rickleigh







PostPosted: Tue Aug 18, 2009 7:21 pm Reply with quote

Would really like to get this going. Its holding back a project on my site. It seems like such a simple fix for some that knows what there looking for (NOT ME Sad )
 
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Tue Aug 18, 2009 7:24 pm Reply with quote

You don't even need all the echo code then. Just put the original script between ?> and <?php

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
rickleigh







PostPosted: Tue Aug 18, 2009 8:18 pm Reply with quote

evaders99 wrote:
You don't even need all the echo code then. Just put the original script between ?> and <?php


After taking out the echo, I get this error in my logs:
PHP Parse error: syntax error, unexpected '}'

Here is the code as I have it now:
Code:
if (!defined('ADMIN_FILE')) {

?>
<!-- http://www.LiveZilla.net Tracking Code -->
<div id="livezilla_tracking" style="display:none"></div><script language="JavaScript" type="text/javascript">
<!-- DON'T REMOVE ANY LINE BREAKS-->
<!--
var script = document.createElement("script");script.type="text/javascript";var src = "http://www.yourhobbycommunity.com/livezilla/server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("script.src=src;document.getElementById('livezilla_tracking').appendChild(script)",1);
// -->
</script>
<!-- http://www.LiveZilla.net Tracking Code -->
<?php
}
Plus I still get the
Quote:
The request needs user authentication
Hint: The request requires user authentication - The server might return this response for a page behind a failed login

Refered From : [ Only registered users can see links on this board! Get registered or login! ]
Your IP : 166.232.55.107
Page Requested : /admin.php
Agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1Cool Gecko/20081029 Firefox/2.0.0.18 (.NET CLR 3.5.30729)
Redirect Status : 401
when I have the custom_footer.php active Sad What a pain in the butt! Can't beleave this has been such a pain to get working correctly. It works fine in the stand alones I have running Rolling Eyes I dont get it. You would think I could just copy and paste it in my footer but for some reason the script wont work in there Sad
 
rickleigh







PostPosted: Wed Aug 19, 2009 7:46 am Reply with quote

Dont give up on me now Wink
 
wHiTeHaT







PostPosted: Wed Aug 19, 2009 9:49 am Reply with quote

could you put your full file content in here?
 
rickleigh







PostPosted: Wed Aug 19, 2009 10:46 am Reply with quote

wHiTeHaT wrote:
could you put your full file content in here?


The last post was the full file content Very Happy

Am I missing something else Question
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©