/**
 * second level of scoping
 *
 */
function testScoping2()
{
    $cage_POST = Inspekt::makePostCage();
    echo "<pre>In " . __FUNCTION__ . "(): ";
    echo var_dump($cage_POST->testAlnum('/funky,_+=_\\|;:!@#$%^&*~time/0/0/`~foo,.+=_\\|;:!@#$%^&*~-bar'));
    echo "</pre>\n";
    echo "<pre>POST is not accessible here: ";
    echo var_dump($_POST);
    echo "</pre>\n";
}
 * @copyright Copyright (c) 2009 Atlanta PHP, LLC
 * @license http://github.com/atlantaphp/mysql-training-contest/raw/master/LICENSE New BSD License
 */
ini_set('display_errors', 0);
require_once 'Inspekt.php';
require_once 'recaptcha/recaptchalib.php';
// This pulls the reCAPTCHA private key from an environment variable. Set this
// in a .htaccess file in the web root, like so:
//
//     SetEnv RECAPTCHA_PRIVATE_KEY xxxxxxxxxxxxxxxxxxxxx
//
define('RECAPTCHA_PRIVATE_KEY', getenv('RECAPTCHA_PRIVATE_KEY'));
define('RECAPTCHA_PUBLIC_KEY', '6LdqewkAAAAAAEX_hHRqeQrCq8My6LPr9V72zMyD');
$endDate = strtotime('November 24, 2009 11:59 PM EST');
$db = new SQLite3('../../db/mysql-contest.db');
$postCage = Inspekt::makePostCage();
$errors = array();
// Determine whether the contest is over
$isOver = false;
if (time() > $endDate) {
    $isOver = true;
}
if (!$isOver) {
    // Determine whether this user has already registered
    $isSignedUp = false;
    if (isset($_COOKIE['atlphp_mysql_contest'])) {
        $isSignedUp = true;
    } else {
        $stmt = $db->prepare('SELECT email FROM entries WHERE ip_addr = :ip_addr');
        $stmt->bindValue(':ip_addr', $_SERVER['REMOTE_ADDR']);
        $result = $stmt->execute();
Exemple #3
0
 /**
  * Enter description here...
  *
  * @see Inspekt_Supercage::Factory()
  * @param string  $config_file
  * @param boolean $strict
  */
 function _makeCages($config_file = NULL, $strict = TRUE)
 {
     $this->get = Inspekt::makeGetCage($config_file, $strict);
     $this->post = Inspekt::makePostCage($config_file, $strict);
     $this->cookie = Inspekt::makeCookieCage($config_file, $strict);
     $this->env = Inspekt::makeEnvCage($config_file, $strict);
     $this->files = Inspekt::makeFilesCage($config_file, $strict);
     // $this->session	= Inspekt::makeSessionCage($config_file, $strict);
     $this->server = Inspekt::makeServerCage($config_file, $strict);
 }
 /**
  * Enter description here...
  *
  * @see Inspekt\Supercage::Factory()
  * @param string $config_file
  * @param boolean $strict
  */
 protected function makeCages($config_file = null, $strict = true)
 {
     $this->get = Inspekt::makeGetCage($config_file, $strict);
     $this->post = Inspekt::makePostCage($config_file, $strict);
     $this->cookie = Inspekt::makeCookieCage($config_file, $strict);
     $this->env = Inspekt::makeEnvCage($config_file, $strict);
     $this->files = Inspekt::makeFilesCage($config_file, $strict);
     $this->server = Inspekt::makeServerCage($config_file, $strict);
 }
 /**
  * 
  */
 public function testMakePostCage()
 {
     $cage = Inspekt::makePostCage();
     $this->assertTrue($cage instanceof Inspekt_Cage);
 }
Exemple #6
0
 /**
  * Enter description here...
  *
  * @see Inspekt_Supercage::Factory()
  * @param boolean $strict
  */
 function _makeCages($strict = TRUE)
 {
     $this->get = Inspekt::makeGetCage($strict);
     $this->post = Inspekt::makePostCage($strict);
     $this->cookie = Inspekt::makeCookieCage($strict);
     $this->env = Inspekt::makeEnvCage($strict);
     $this->files = Inspekt::makeFilesCage($strict);
     /**
      * Don't put session in cage as it will nullify $_SESSION and we will loose the session completely.
      * TODO: Find a way to put the session data in cage and still retain the session correctly
      */
     //$this->session= Inspekt::makeSessionCage($strict);
     $this->server = Inspekt::makeServerCage($strict);
 }
Exemple #7
0
 /**
  * 
  */
 public function testTestAlnum3()
 {
     $_POST = array();
     $_POST['b'] = '0';
     $cage_POST = Inspekt::makePostCage();
     $result = $cage_POST->testLessThan('b', 25);
     $this->assertSame('0', $result);
 }