studgate Posted August 28, 2007 Share Posted August 28, 2007 I have three forms in my database, when each form is submitted the current username is automatically entered into the database, and I want the user to be able to edit only their entries. Everybody can view the entries but only them can update it. How do I do that?? Thanks in advance guys Quote Link to comment https://forums.phpfreaks.com/topic/67068-allow-users-to-update-only-their-own-entries/ Share on other sites More sharing options...
frost Posted August 28, 2007 Share Posted August 28, 2007 Well I assume you are making people login? Once logged in you can use a cookie or session to store the username, then you can pull only the relevant entries from your database based on that name. Quote Link to comment https://forums.phpfreaks.com/topic/67068-allow-users-to-update-only-their-own-entries/#findComment-336320 Share on other sites More sharing options...
datafan Posted August 28, 2007 Share Posted August 28, 2007 You could set a cookie at login like this: $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 7200; setcookie(ID_yoursitename, $_POST['username'], $hour,'/'); Then check to make sure it's there like this: if(isset($_COOKIE['ID_yoursitename'])) { do something } And you gotta do the cookie stuff before you output anything to the browser in your script. Quote Link to comment https://forums.phpfreaks.com/topic/67068-allow-users-to-update-only-their-own-entries/#findComment-336324 Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 Of course, cookies can be edited, so you'll need to use sessions instead or at least in conjunction with. Quote Link to comment https://forums.phpfreaks.com/topic/67068-allow-users-to-update-only-their-own-entries/#findComment-336329 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.