Forum Moderators: open

Message Too Old, No Replies

Problem with js file!

Problem with js file and PHP

         

maria82487

2:31 pm on Sep 20, 2003 (gmt 0)

10+ Year Member



Hi everyone,

I'm having a problem with a site counter. The application that I have right now is based on PHP, but it also have a js file with. However, the free server that I have right now for some reason can not read js file, so every time I try to upload the js file, the server keep saying that the file type is wrong, therefor it won't let me upload it. Can someone please help me? Is there a way to go around this? Can I rename the js file some thing else? Or can I just put the js file right into the php.

Thanks a lot for your time.

maria!

jaski

2:50 pm on Sep 20, 2003 (gmt 0)

10+ Year Member



Hi Maria,
Welcome to the Webmasterworld.

Its strange that a server won't let you upload a file. (any file)

I believe you are talking about client side javascript file. You can copy and paste the contents of js file inside your PHP file ie.

<script language = javascript>
CONTENTS OF JS FILE
</script>

This should preferably be done inside <head></head>.

maria82487

3:28 pm on Sep 20, 2003 (gmt 0)

10+ Year Member



Wow,
that was fast, thank you very much for your fast respone. But it doesn't seem to work. Here is some more info about the script that I have right how.

This is the code that will call up the php page and write the log file:

<script language="javascript" src="uf.js"></script>
<noscript><img src="http://www.yourdomain.com/yourpathto/UFDust.php?&js=n"></noscript>

This is the js file code:

var refz = escape(document.referrer)+"";

if (!refz) { refz = "Direct Request"; }; var URLloc = escape(document.location)+""; var js = "Enabled";
if (navigator.cookieEnabled) { cSupport = "Enabled"; } else cSupport = "Disabled";
function machiner() { if (navigator.cpuClass) { switch (navigator.cpuClass) { case "x86" : theCpu = "x86 [Intel processor]"; break; case "68K" : theCpu = "68K [Motorola processor]"; break; case "Alpha" : theCpu = "Alpha [Digital processor]"; break; case "PPC" : theCpu = "PPC [Motorola processor]"; break; case "Other" : theCpu = "Other"; break; }; } else { theCpu = "Unknown"; }; return theCpu; }; var cpuz = machiner();
var usd = screen.width + "x" + screen.height ; var usc = screen.colorDepth + "Bit";
dpass="&js="+js+"&cSupport="+cSupport+"&cpuz="+cpuz+"&usd="+usd+"&usc="+usc+"&refz="+refz+"&URLloc="+URLloc;

st="<img src='"; mi="http://www.hostinganime.com/msn/stats/UFDust.php?"; en="' alt='' border='0'>";

document.write(st+mi+dpass+en);

I tried to put the js code on the same page with the php, but it still doesn't work. I think it might be because of this link of code "<noscript><img src="http://www.yourdomain.com/yourpathto/UFDust.php?&js=n"></noscript>".

Any help will be greatful.

maria