Codeigniter PHP time constraint -


i creating article sharing application using codeigniter php. every article has 3 text boxes including name,email , comment. need block comments come within 1 minute of previous comment same user.how can so? can me?

simply add timestamp last_updated field each user ( it's user related, , not each comment related ), , select last update_time user, compare , if time less period want, in case minute.

if constraint not critical, can control javascript in client ( having same mark variable, , comparing time elapsed last update ).

for php:

$last_update = $db->get_var("select last_updated time_comments user_id='$uid'");  $elapsed = time() - $last_update;  if($elapsed < 60){    echo 'cannot comment'; }  //process comment 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -