Windows 2003 and Linux web hosting - Debt Consolidation - Debt Consolidation - Windows 2003 and Linux web hosting - Free Animated Greetings

PDA

View Full Version : Hide function for forum hep needed. :)


aliks0905
Dec 3rd 2007, 1:28 pm
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. }

vonvhen
Dec 4th 2007, 11:02 am
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']))

aliks0905
Dec 4th 2007, 12:00 pm
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.

vonvhen
Dec 4th 2007, 12:28 pm
http://php.net/reserved.variables

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