homepage Welcome to WebmasterWorld Guest from 54.161.214.221
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Allowing 'registered' members to view different content then 'non reg'
Registered users seeing different content
brettxw




msg:4264069
 7:39 am on Feb 8, 2011 (gmt 0)

I know how to set it so the download link is not visible for 10 seconds (timed countdown) How would I go about setting it so viewers who are not logged in (or not registered users) see the 10 second countdown before being able to click the link, however if they are a registered member and have logged in, they see the link with out the countdown delay.

 

Kings on steeds




msg:4264988
 5:53 am on Feb 10, 2011 (gmt 0)



session_start();

if(!isset($_SESSION['user'])){
echo "<script>start_count_down();</script>";
} else {
echo "<a href='link'>download my thing</a>";
}


This code assumes you have a time Javascript, that should go in the script tag. it also assumes you have some code settings the user session. (e.g. a login script)

If you know what their IP's are you could do it using

$ips = array('1.1.1.1','2.2.2.2','3.3.3.3');
if(!in_array($_SERVER['REMOTE_ADDR'], $ips)){


Good luck :-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved