Jiraiya Posted January 12, 2009 Share Posted January 12, 2009 i have a script that allows users to view other members profiles but im not sure how to create a script that checks if the target profile has there profile variable set to "public" so i need it to check if the target profile's user has there "profile" variable set to "public" and if it is set to public continue to run the script to view the profile but if it he "profile" variable is set to anything but "public" it redirects the user trying to view the profile to another page Quote Link to comment Share on other sites More sharing options...
bluesoul Posted January 12, 2009 Share Posted January 12, 2009 <?php $q = "SELECT view FROM profiles WHERE username='{$_POST['username']}' LIMIT 1"; $query = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_assoc($query); if($row['view'] == "private") { echo "This profile is set to private, redirecting you. <meta http-equiv=\"refresh\" content=\"3;url=index.php\" />"; } else { //display profile } ?> That's a rough idea, I'd highly recommend escaping posted data rather than using it directly in a query at the least. 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.