leeandrew Posted March 11, 2008 Share Posted March 11, 2008 I want to show content on my site only to users that have over a certain number of points. users earn points and are stored in cell `points` I want to show content to users with over 50 points... currently i have it to show admins only with this code: <?php // If the user is an administrator, show the admin index. if($isAdmin) { require "hiddencontent/index.php"; } ?> How can i edit this to show only to users with over 50 points? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 11, 2008 Share Posted March 11, 2008 <?php // If the user is an administrator, show the admin index. if($points >= '50') { require "hiddencontent/index.php"; } ?> Set point number to the variable $points Quote Link to comment Share on other sites More sharing options...
leeandrew Posted March 11, 2008 Author Share Posted March 11, 2008 Thanks for your help! I changed it to this and now its working: <?php // If the user is an administrator, show the admin index. if($User->points >= '50') { require "hiddencontent/index.php"; } ?> Thanks Quote Link to comment Share on other sites More sharing options...
leeandrew Posted March 11, 2008 Author Share Posted March 11, 2008 How do i mark as solved? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 11, 2008 Share Posted March 11, 2008 That feature hasnt been installed since the update. Quote Link to comment Share on other sites More sharing options...
leeandrew Posted March 11, 2008 Author Share Posted March 11, 2008 I have added an else feature too. So for anyone wanting to display something similar, the code is as follows... <?php // If the user is an administrator, show the admin index. if($User->points >= '50') { require "hiddencontent/index.php"; } else { echo " <p style='border:1px dashed red;background-color:white'> You need at least <b>50 points</b> to unlock this section</b> </p> "; } ?> If your user has 50 or more points in DB cell `points` they are shown the content from file 'hiddencontent/index.php', if they have less than 50 they are shown the else message. Cheers for your help peranha! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.