Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2003-01-23 10:59
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;
}
?>