PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Eugene Panin   Semaphore   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Usage example
Class: Semaphore
Form processing locking
Author: By
Last change:
Date: 21 years ago
Size: 400 bytes
 

Contents

Class file image Download
<?php
// Example of usage of Semaphore class
include "semaphore.php";

// Processing of double submit click
// Lock the register process till the registration end

$s = new Semaphore($companyFullName);
if (
$s->lock()) {
 
// Write company to database here
 
$s->unlock();
  echo
"Company succesfully registered";
}
else {
  echo
"ERROR: You pressed submit button twice";
  exit;
}
?>