spyderfusion02 Posted July 19, 2008 Share Posted July 19, 2008 Hey I would like to allow only the user of my site to post stories. Im new to PHP and was wondering if anyone had tutorials on this topic or any info on where I should start? Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/ Share on other sites More sharing options...
MasterACE14 Posted July 19, 2008 Share Posted July 19, 2008 are you grabinng the user permissions from a database? if so you could do something like this: <?php if($row['permission'] == 1) { // display post story form } else { echo "You do not have permission to post a story!"; } ?> Regards ACE Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-593980 Share on other sites More sharing options...
spyderfusion02 Posted July 19, 2008 Author Share Posted July 19, 2008 I would like to allow people to post stories only when they are logged in. If they are not then they would have to register for an account. Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-593983 Share on other sites More sharing options...
MasterACE14 Posted July 19, 2008 Share Posted July 19, 2008 <?php if(!isset($_SESSION['loggedin'])) { die("You must be logged in! If you don't have a Account you can <a href=\"register.php\">register one</a>"); } else { // display the post story form } ?> Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-593985 Share on other sites More sharing options...
spyderfusion02 Posted July 19, 2008 Author Share Posted July 19, 2008 Cool, I'll play around with that. Thanks for the quick response. Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-593995 Share on other sites More sharing options...
vikramjeet.singla Posted July 19, 2008 Share Posted July 19, 2008 please refer to following link for user authentications: http://www.tutorialized.com/tutorials/PHP/User-Authentication/1 http://www.codewalkers.com/c/a/Miscellaneous/Writing-a-Basic-Authentication-System-in-PHP/ enjoy... Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-594001 Share on other sites More sharing options...
MasterACE14 Posted July 19, 2008 Share Posted July 19, 2008 note, for each page a user must be logged in to view, if your going to use sessions. you need this at the very top of each page before anything else.... <?php session_start(); Regards ACE Link to comment https://forums.phpfreaks.com/topic/115544-member-permissions-egonly-users-can-post-story/#findComment-594003 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.