Hide function for forum hep needed. :)

Discussion in 'PHP' started by aliks0905, Dec 3, 2007.

  1. #1
    Hi, I have modified my code for my modded phpbb forum, and I just have a quick question and if its a possible one.

    My hide 'hack' currently is set to hide the hidden content (using [hide] tags) from everybody except: admins/mods, and those with over 50 posts. Is it possible to also add to that exceptions list that if someone is referred from a certain site (google.com) then they can see the hidden content as well?

    Here is my code:
    
       1. if($item['iteration'] > 1)  
       2.            {  
       3.                return $error;  
       4.            }  
       5.            global $db, $topic_id, $userdata, $mode;  
       6.            $show = false;  
       7.            if($userdata['session_logged_in'])  
       8.            {  
       9.                $sql = "SELECT p.poster_id, p.topic_id  
      10.                    FROM " . POSTS_TABLE . " p  
      11.                    WHERE p.topic_id = $topic_id  
      12.                    AND p.poster_id = " . $userdata['user_id'];  
      13.                $resultat = $db->sql_query($sql);  
      14.                $show = $db->sql_numrows($resultat) ? true : false;  
      15.                if ( ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MOD) || ($userdata['user_posts'] > 50))  
      16.                {  
      17.                    $show = true;  
      18.                } 
    
    Code (markup):

     
    aliks0905, Dec 3, 2007 IP
  2. vonvhen

    vonvhen Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do a check on the HTTP_REQUEST for a sudden domain. If it matches, flag it to true. Then append it to the IF statement.

    if (($ApprovedSites)||($userdata['session_logged_in']))
     
    vonvhen, Dec 4, 2007 IP
  3. aliks0905

    aliks0905 Member

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Thanks, can you tell me what code to put in to check for the HTTP_REQUEST...or a site that explains this? I hardly know php.
     
    aliks0905, Dec 4, 2007 IP
  4. vonvhen

    vonvhen Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    http://php.net/reserved.variables

    <?php
    if($_SERVER['HTTP_REFERER'] != ''){
    $URL = parse_url($_SERVER['HTTP_REFERER']);
    echo "Welcome, <b>".$URL['host']."</b> visitor!";
    }
    ?>
     
    vonvhen, Dec 4, 2007 IP