Facebook's sharer on php?

Discussion in 'Web Sites/Design' started by subatoi, May 1, 2010.

  1. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
  2. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    What's the error message? Those are produced for a reason! :)
     
  3. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    It simply says:
    "The html tags you attempted to use are not allowed"

    That's all.:klingon:
     
  4. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    That's going to be an issue with the site you're trying to deploy it on. Where are you trying to use this Facebook Share button?
     
  5. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    Next to a text I upload.
    I don't understand much in PHP, so keep it simple :)
     
  6. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Do you have a link or something? There are not many tags in this:

    Code:
    <a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
    I suspect it's the "script" tag that is forbidden. Whatever PHP software you are using is filtering out certain HTML tags. That's why I'm asking what you're deploying this on. There may or may not be an easy way to get the "script" tag allowed, but I cannot determine that without knowing what PHP program you're using.
     
  7. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
  8. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Bingo! You're using PHP-Nuke.

    Open your config.php file and look for "$AllowableHTML". You should see something like this:

    Code:
    $AllowableHTML = array("b"=>1,
             "i"=>1,
             "a"=>2,
             "em"=>1,
             "br"=>1,
             "strong"=>1,
             "blockquote"=>1,
             "tt"=>1,
             "li"=>1,
             "ol"=>1,
             "H1"=>1,
             "H2"=>1,
             "H3"=>1,
             "H4"=>1,
             "center"=>1,
             "img"=>2,
             "alt"=>1,
             "table"=>2,
             "tr"=>2,
             "td"=>2,
             "p"=>2,
             "div"=>2,
             "font"=>2,
             "p"=>1,
             "p"=>1,
             "ul"=>1);
    
    In the middle of that block, add this line:

    Code:
             "script"=>2,
    
    Save your config.php file and try to add the Facebook Share button again.

    Let me know if that works for you!
     
  9. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    OK... now all I need to know is where to find that config.php file. Supposed to be on the site files somewhere?
    (I got this site, I didn't build it myself... :) )
     
  10. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Yeah, just do a scan down your files for "config.php". There should be only one! If in doubt, use the one with the most recent timestamp on it.
     
  11. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    In the latest of about 10-15 files, I've added that somwhere in the middle, and it still gives me the same message :(
    Unless it changes where exactly I add it...?
     
  12. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    No, it doesn't matter where in the array you add it. Very odd.

    Could you possibly take a screenshot of the error you're getting and post it here, or PM it to me? I will see what else I can dig up. You should also go through your PHP-Nuke configuration and see if you are restricting HTML tags anywhere, because that's the source of your problem. You need to allow the "script" tag.
     
  13. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    If I only knew where to start...
    Maybe I'll try one of the other "config.php" files.


    A screenshot:
    http://forums.ort.org.il/files/213/2567819/7932889.JPG
     
  14. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Something else to make sure of: check the AllowableHTML array in your config.php, and make sure it has this:

    Code:
    "a"=>2,
    
    The "2" is important, because that's what lets you have attributes on the link tag.

    Also, in mainfile.php, look for this block of code:

    Code:
    foreach ($_GET as $secvalue) { 
        if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*object*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*style*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*form*\"?[^>]*>", $secvalue)) || 
            (eregi("\([^>]*\"?[^)]*\)", $secvalue)) || 
            (eregi("\"", $secvalue))) { 
       die ("<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\"javascript:history.go(-1)\"><b>Go Back</b></a> ]"); 
        } 
    } 
    
    foreach ($_POST as $secvalue) { 
        if ((eregi("<[^>]script*\"?[^>]*>", $secvalue)) ||  (eregi("<[^>]style*\"?[^>]*>", $secvalue))) { 
            die ("<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\"javascript:history.go(-1)\"><b>Go Back</b></a> ]"); 
        } 
    } 
    
    Replace it with this:

    Code:
    foreach ($_GET as $secvalue) { 
        if ((eregi("<[^>]*object*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*style*\"?[^>]*>", $secvalue)) || 
            (eregi("<[^>]*form*\"?[^>]*>", $secvalue)) || 
            (eregi("\([^>]*\"?[^)]*\)", $secvalue)) || 
            (eregi("\"", $secvalue))) { 
       die ("<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\"javascript:history.go(-1)\"><b>Go Back</b></a> ]"); 
        } 
    } 
    
    foreach ($_POST as $secvalue) { 
        if ((eregi("<[^>]script*\"?[^>]*>", $secvalue)) ||  (eregi("<[^>]style*\"?[^>]*>", $secvalue))) { 
            die ("<center><img src=images/logo.gif><br><br><b>The html tags you attempted to use are not allowed</b><br><br>[ <a href=\"javascript:history.go(-1)\"><b>Go Back</b></a> ]"); 
        } 
    } 
    
    (I just removed the security check for "script" tags.)
     
  15. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    Checked the two things. Nope.

    Is there a point checking another config.php? There are some that are not on the main directory.
     
  16. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Tell you what, why don't you PM me? I'd be happy to take a look at this for you and fix it directly.
     
  17. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
  18. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    I just went to your site and clicked both the "Like" and "Recommend" buttons, and they worked. I think you're in good shape!
     
  19. subatoi

    subatoi Lieutenant Red Shirt

    Joined:
    Oct 17, 2005
    But do you see the link on your news feed, or just on the recent activity page? It's supposed to be on the former but I only get the latter.
     
  20. Robert Maxwell

    Robert Maxwell memelord Premium Member

    Joined:
    Jun 12, 2001
    Location:
    space
    Could you link me to each one? I can't exactly read Hebrew so I don't know which is which. :p