runnerjp Posted July 4, 2009 Share Posted July 4, 2009 What would the best way/how would i , add a time limit for a user to edit a post?? so say i made a post and needed to chnage it, then id only have 2 hours to change it , and then display to the user how longs left?? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 4, 2009 Share Posted July 4, 2009 You could simply store a timestamp/datetime when a new post insert has been done and then compare that to the time the form page gets loaded. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted July 4, 2009 Author Share Posted July 4, 2009 humm ok so iv got my post added into the db as 'showtime' to edit a post i do this use a link with the post id in it like so <a href="index.php?page=reply&forum=<?php echo $forum; ?>&id=<? echo $forumpostid ?>&pid=<? echo $getreplies3['editid']; ?>">Edit</a> so how can i find out if 2 hours have passed to use in if statement? Quote Link to comment Share on other sites More sharing options...
runnerjp Posted July 4, 2009 Author Share Posted July 4, 2009 i tried this <?php $last_active = time() - $getreply3['showtime']; echo ($last_active < 300) ? ' <a href="index.php?page=reply&forum=$forum&id=$forumpostid&pid=$getreply3["'.postid.'"]">Edit</a>| Report ': "Edit";?> but it just shows edit even if the time has been 2 seconds :S 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.