I have a javascript in my site code that if I remove or modify it causes the other PHP that is parsed on that page to go nuts with error messages. The script in question (below) prevents anyone from right clicking and copying anything off of my site. Considering I have a classifieds site this cut and paste prevention is an inconvenience for anyone using my site trying to post lots of pics and info. I posted in the java forum to see if anyone has any ideas regarding the script and somone suggested I try and post in this forum for help. I am wandering if I am breaking some PHP loop whenever I try and delete or modify the script although I have experemented deleting other java scripts on the page and I can without problem. I would appreciate any suggestions..thanks. <SCRIPT LANGUAGE="JavaScript1.1"> <!-- Begin function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Sorry Pal, Permission Disallowed !"); return false; } return true; } document.onmousedown=right; document.onmouseup=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); window.onmousedown=right; window.onmouseup=right; // End --> </script> Code (markup):
Java != JavaScript And don't bother posting some PHP code or the errors that go with it, this way it's so much more fun!
the error message I get when I remove or modify the script is warning:[function.main] failed to open stream. no such file or in directory/home.php on line 43 Code (markup): This error appears wherever <? include('.php'); ?> Code (markup): a PHP file is being parsed on the page.
Below is a sample of the code from my home page. When I remove the javascript I get an error message that says it can not find the file or stream on line 43, 54 and wherever else there is <? include('file.php'); ?> on the page. I hope that is a little clearer..thanks 43.<td class="pageTitle"> <? include('browsestate.php'); ?> 44.</td> 45. <td height="1"><img src="images/pixel.gif" width="1" height="1" 46.alt=""></td> 47. </tr> 48. <tr> 49. <td><table width="100%" border="0" cellspacing="1" cellpadding 50. 51.="0" bgcolor="#666666"> 52. <tr> 53. <td bgcolor="#f6f6f6" align="center"> 54. <? include('featured.php'); //fetch 5 featured properties ?> Code (markup):
I get error messages on my home page If I remove a javascript from the code in my site that is written in PHP. If you cant understand that sentence or even come up with a broad guess as to what remotely may cause such an error then please move on to another thread with your genius comments.
I completely understand your problem so stuff it with your wannabe clever remarks. The thing is that the code in question DOESN'T HELP AT ALL in trying to figure out what is wrong, so instead of telling me I'm incapable of helping you you might want to post some code that actually helps. If you don't want to post more code than you already posted, that's fine, but don't take it out on people who are trying to help you.
My apologies. Just a little frustrated 'cuz I am loosing repeat visitors to my site because they have to manually type a whole listing sheet into my site instead of being able to cut and paste and I have posted what the issue is numerous times to no avail... Anyways, lets start over...Below is most of the code to my home.php file. At the bottom sits that javacsript(red). I guess one of the questions would be why would removing that script have an adverse effect on the rest of my site being able to retrieve .php files from the server? I highlighted in blue <? include('anyfile.php'); ?></td> because this is what goes bizerk when I remove that script. Also, I attached a snapshot of part of my site that shows some of the error messages I get when the script is removed. [B]43.[/B][COLOR="Blue"]<td class="pageTitle"><? include('browsestate.php'); ?></[/COLOR]td> </tr> <tr> <td class="pageTitle"> </td> </tr> <tr> <td class="pageTitle"> <hr size="1" color="#666666"> </td> </tr> <tr> <tr> <td class="pageTitle"> </td> </tr> <tr> <td class="pageTitle">Featured Property Listings</td> </tr> <tr> <td height="1"><img src="images/pixel.gif" width="1" height="1" alt=""></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#666666"> <tr> <td bgcolor="#f6f6f6" align="center"> [COLOR="blue"]<? include('featured.php'); //fetch 5 featured properties ?>[/COLOR] </td> </tr> </table></td> </tr> <tr> <td height="15"><img src="images/pixel.gif" width="1" height="1" alt=""></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="pageTitle">Featured Article</td> </tr> <tr> ### FETCH FEATURED NEWS FROM SETTINGS $settingsSql = 'select * from settings where id = 1'; $settingsR = mysql_query($settingsSql,$myconn) or die(mysql_error()); $settings = mysql_fetch_assoc($settingsR); $featuredSql = 'select * from news where id = '.$settings['defaultNewsID']; $featuredR = mysql_query($featuredSql,$myconn) or die(mysql_error()); $featured = mysql_fetch_assoc($featuredR); ?> <div class="pageSubTitle"><? echo $featured['title']; ?></div> <div class="pageText"><? echo substr($featured['description'],1,300); ?> <a href="fullnews.php?id=<? echo $featured['id']; ?>" class="pageLink">Full Story <td height="20"><img src="images/pixel.gif" width="1" height="1" alt=""></td> </tr> <tr> <td height="10"><img src="images/pixel.gif" width="1" height="1" alt=""></td> </tr> <tr> <td height="30" colspan="2"><img src="images/pixel.gif" width="1" height="1" alt=""></td> </tr> </table> [COLOR="Red"]<SCRIPT LANGUAGE="JavaScript1.1"> <!-- Begin function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Sorry Pal, Permission Disallowed !"); return false; } return true; } document.onmousedown=right; document.onmouseup=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); if (document.layers) window.captureEvents(Event.MOUSEUP); window.onmousedown=right; window.onmouseup=right; // End --> </script>[/COLOR] Code (markup):