makeSuperCage() public static method

Returns a SuperglobalsCage object, which wraps ALL input superglobals
public static makeSuperCage ( string $config_file = null, boolean $strict = true ) : SuperglobalsCage
$config_file string
$strict boolean whether or not to nullify the superglobal
return SuperglobalsCage
Exemplo n.º 1
0
/**
 * a wrapper to retrieve input from either the get or post Inspekt cages
 *
 * @param string $key the key you're trying to retrieve
 * @param string $accessor the name of the accessor method to use
 * @return mixed  null if key does not exist
 * @author Ed Finkler
 */
function getInputGP($key, $accessor)
{
    /*
        this returns the singleton
    */
    $sc = Inspekt::makeSuperCage();
    if ($sc->get->keyExists($key)) {
        return $sc->get->{$accessor}($key);
    } elseif ($sc->post->keyExists($key)) {
        return $sc->post->{$accessor}($key);
    } else {
        return null;
    }
}
Exemplo n.º 2
0
<?php

require_once dirname(__FILE__) . "/../vendor/autoload.php";
use Inspekt\Inspekt;
$superCage = Inspekt::makeSuperCage();
echo "<pre>";
var_dump($superCage);
echo "</pre>\n";
echo 'Digits:' . $superCage->server->getDigits('SERVER_SOFTWARE') . '<p/>';
echo 'Alpha:' . $superCage->server->getAlpha('SERVER_SOFTWARE') . '<p/>';
echo 'Alnum:' . $superCage->server->getAlnum('SERVER_SOFTWARE') . '<p/>';
echo 'Raw:' . $superCage->server->getRaw('SERVER_SOFTWARE') . '<p/>';
Exemplo n.º 3
0
<?php

require_once dirname(__FILE__) . "/../vendor/autoload.php";
use Inspekt\Inspekt;
$_POST['userid'] = "\\'; DESC users; --";
$_POST['email'] = '*****@*****.**';
$_POST['text'] = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus nisl dolor, pulvinar id, pharetra a, egestas nec, ante. Duis scelerisque eleifend metus. Sed non odio id odio varius rutrum. Pellentesque congue commodo lacus. In semper pede lacinia felis. Morbi mollis molestie lorem. Morbi suscipit libero. Quisque ut erat sit amet elit aliquam nonummy. Donec tortor. Aliquam gravida ullamcorper pede. Praesent eros. Sed fringilla ligula sed odio pharetra imperdiet. Integer aliquet quam vitae nibh. Nam pretium, neque non congue vulputate, odio odio vehicula augue, sit amet gravida pede massa ac lectus. Curabitur a libero vitae dui sagittis aliquet. Ut suscipit. Curabitur accumsan sem a urna. Ut elit pede, vulputate sed, feugiat quis, congue sed, lacus.';
$mysql_conn = mysql_connect('localhost', 'inspekt_test', 'ewp-odd-ia');
$sc = Inspekt::makeSuperCage();
echo $sc->post->escMySQL('userid', $mysql_conn);
Exemplo n.º 4
0
 /**
  *
  */
 public function testMakeSuperCage()
 {
     $cage = Inspekt::makeSuperCage();
     $this->assertTrue($cage instanceof SuperglobalsCage);
 }
Exemplo n.º 5
0
    <title>formtest</title>

</head>

<body>
<form action="formtest.php" method="POST">
    <h3>Enter 5 email addresses</h3>
    <input type="text" name="email_addresses[group1][a]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group1][b]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group1][c]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group2][a]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group2][b]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group3][a]" value="*****@*****.**"/><br/>
    <input type="text" name="email_addresses[group3][b]" value="*****@*****.**"/><br/>

    <input type="submit" name="submit" value="Go!" id="submit"/>
</form>

<?php 
$input = Inspekt::makeSuperCage();
$email = $input->post->testEmail('/email_addresses/group3/a');
if ($email) {
    echo $email;
} else {
    echo "invalid address";
}
?>

</body>
</html>