Jump to content

[SOLVED] Post Timer?


Crew-Portal

Recommended Posts

Hi I am creating a Virtual Airline Manager (For Flight Simulator). My problem is that i only want a member to be allowed to post a flight and then it locks the page for 1 hour so that they cannot post multiple flights. How would I go about locking the Insert into * functions and just displaying something like:

 

You may not Post another flight.

You may post again in $time.

Link to comment
https://forums.phpfreaks.com/topic/63377-solved-post-timer/
Share on other sites

Erm, the script doesn't run for an hour though does it? Cause if it does that'll give you other issues to deal with. But what I'd do is create some sort of boolean field that's stored in a database that says... is the page locked or not. Then display the appropriate message/take action.

Link to comment
https://forums.phpfreaks.com/topic/63377-solved-post-timer/#findComment-315905
Share on other sites

When the user posts the flight, u can insert in a specific column (maybe in the users table in a column like lastPost) the actual date and time. When he tries to post another flight, compare the database time with the actual date and time and if it is more then one hour let him post. When he posts again, override the old date so the process starts all over.

Link to comment
https://forums.phpfreaks.com/topic/63377-solved-post-timer/#findComment-315908
Share on other sites

<?php

// Insert date("G") into database field

// Pull this variable from database

$dbfieldtimevar = $row["postTime"];

$allowentrance = $dbfieldtimevar + 1;

$currenthour = date("G");

if ($currenthour >= $allowentrance)
{
// allow user to access mysql_query
}
else
{
echo "Hey I Know You!";
exit;
}

?>

 

Or something like this - maybe......

 

Might have to tweak it a bit for 12:AM though

Link to comment
https://forums.phpfreaks.com/topic/63377-solved-post-timer/#findComment-315925
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.