Can't remove Java out of My PHP?

Discussion in 'PHP' started by classifiedsrealtor, Feb 13, 2007.

  1. #1
    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.:confused:
    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):

     
    classifiedsrealtor, Feb 13, 2007 IP
  2. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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!
     
    Icheb, Feb 13, 2007 IP
  3. classifiedsrealtor

    classifiedsrealtor Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    classifiedsrealtor, Feb 13, 2007 IP
  4. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    include('.php'); won't work, so you might want to post some additional code.
     
    Icheb, Feb 13, 2007 IP
  5. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    So what's the line 43 on home.php? More information would be welcome...
     
    Choller, Feb 14, 2007 IP
  6. classifiedsrealtor

    classifiedsrealtor Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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):
     
    classifiedsrealtor, Feb 14, 2007 IP
  7. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #7
    No, it's not.
     
    Icheb, Feb 14, 2007 IP
  8. classifiedsrealtor

    classifiedsrealtor Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8

    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.
     
    classifiedsrealtor, Feb 14, 2007 IP
  9. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #9
    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.
     
    Icheb, Feb 14, 2007 IP
  10. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I agree with Icheb.
     
    Choller, Feb 15, 2007 IP
  11. classifiedsrealtor

    classifiedsrealtor Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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">&nbsp;</td>
      </tr>
      <tr> 
        <td class="pageTitle"> <hr size="1" color="#666666"> </td>
      </tr>
      <tr> 
      <tr> 
        <td class="pageTitle">&nbsp;</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); ?>&nbsp;&nbsp;&nbsp;<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):
     

    Attached Files:

    classifiedsrealtor, Feb 15, 2007 IP