Answer the question
In order to leave comments, you need to log in
How to count registered users?
There is a makeyourpizza.ru service that registers people for a master class. Static html page with styles and js on apache.
Task: when recording 6 people for a date, close it for recording. From php to YOU and I don’t understand how to implement it.
We need apparently an elementary counter in php, to which js will send information when someone has signed up and read when it will form a calendar with available data.
Post a link or give me a hint.
Answer the question
In order to leave comments, you need to log in
I sat for half a day and wrote the same counter:
$obj = json_decode(file_get_contents('php://input'), true);
$month = $obj["month"];
$date = $obj["days"];
$do = $obj["do"];
if ($do != "0") {
foreach ($date as $day) {
$file = "./order/$month/$day.txt";
$quantity = file_get_contents($file);
if ($quantity and ($quantity + 0) < 6) {
$quantity = $quantity + 1;
file_put_contents($file, $quantity, LOCK_EX);
} elseif (!$quantity) {
file_put_contents($file, 1, LOCK_EX);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question