somebody help me with php script

Discussion in 'PHP' started by c-bolank, Nov 10, 2012.

  1. #1
    I beg aid to the master php, I was publisher of google and Bidvertiser. My question: how to get google ads do not appear in search results on my blog, for example: www. findlookup.in/?s=s*x .com
    if anyone can help me, I will give a memento as a token of my gratitude.
     
    Solved! View solution.
    c-bolank, Nov 10, 2012 IP
  2. #2
    So you want the ads to not appear on the results pages :confused: if so something like this may work
    (In the example below I borrowed the ad code from your site in your signature) ;)

    
    <?php
    //echo substr(rawurldecode($_SERVER['PHP_SELF']), 1, 2).'<br>'; #echo to find URI sub-string match
    
    if(substr(rawurldecode($_SERVER['PHP_SELF']), 1, 2)!=='?s'){
    echo 
    ' <!-- Begin BidVertiser code -->
    <SCRIPT LANGUAGE="JavaScript1.1" SRC="http://bdv.bidvertiser.com/BidVertiser.dbm?pid=334031&bid=1223526" type="text/javascript"></SCRIPT>
    <noscript><a href="http://www.bidvertiser.com">internet marketing</a></noscript>
    <!-- End BidVertiser code --> ';
    }else{
    echo 'IN HTML - ANOTHER AD NETWORK, YOUR OWN AFFILIATE LINKS, AN IMAGE OR LEAVE BLANK!';
    }
    ?>
    
    PHP:
    The code is basically asking itself if from http://www.example.info/?s=example.com the '?s' is not present in its page URI sub-string. If so ie: the '!==' operator match is not identical to the '?s' URI sub-string then it returns true (a non-match) and hence echo's out the first channel, the HTML ad code— this will happen if you are on any other page on site (including the index page) that is not the results page.

    However if the operator returns false ie: the opposite of '!==' in other words matches identically the '?s' in the URI sub-string the script will echo out the second channel where you can place any other HTML (or none at all)— this will happen if you are only on the results page on site, excluding index page and all other pages. :)


    I need to point out you'll probably need to place this directly into the core of your script to get it's functionality working unless of course you have provisions in your CMS for php input/editing.





    ROOFIS:cool:
     
    Last edited: Nov 10, 2012
    ROOFIS, Nov 10, 2012 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    @roofis; why not this way? if (!isset($_GET['s'])) instead of the urldecode part?
     
    EricBruggema, Nov 11, 2012 IP
  4. ROOFIS

    ROOFIS Well-Known Member

    Messages:
    1,234
    Likes Received:
    30
    Best Answers:
    5
    Trophy Points:
    120
    #4
    Yeah that would work too as it will return true if no data is set in the query string— however this would work with form submission URI's strings only.

    To note urldecode is there for normalizing URI data if special chars where present which would allow correct readability for the opening boolean, probably an overkill and maybe not even needed.

    I wrote that opening boolean to handle all URI string types, form data or not, dynamic or static URI's or any other mainly for versatility for any webpage, but if the OP wants it for from data only then the !isset option is more to the point.





    ROOFIS:cool:
     
    ROOFIS, Nov 11, 2012 IP
  5. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    how about if(isset($_GET['s']) && !empty($_GET['s']))
     
    ogah, Nov 12, 2012 IP