Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.