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?? Link to comment https://forums.phpfreaks.com/topic/164743-solved-applying-a-time-limit-to-edit-posts/ 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. Link to comment https://forums.phpfreaks.com/topic/164743-solved-applying-a-time-limit-to-edit-posts/#findComment-868740 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? Link to comment https://forums.phpfreaks.com/topic/164743-solved-applying-a-time-limit-to-edit-posts/#findComment-868844 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 Link to comment https://forums.phpfreaks.com/topic/164743-solved-applying-a-time-limit-to-edit-posts/#findComment-868852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.