<?php
/*
* Demonstration file.
* @index.php
*/
# Calculating time of SecureLab's operations execution
$LoadingDate = microtime(true);
define( "SECURELAB_PATH", "securelab" );
# Including SecureLab's file.
@ include_once("securelab/securelab-main.php");
# Creating a new copy os SecureLab class.
@ $_SecureLab = new SecureLab();
# Trying to rewrite $_GET[]: by default disallowed.
# To edit this parameter edit system/configuration/SLConfiguration.Filters.Secured.php
@$_GET["Demo"] = "New parameter";
# To view the result, please enter url: current url + index.php?Demo=*nas%^5s7(hide@address.com
# Demonstration of default filter (ID1): allowed using without additional parameters.
print @$_GET["Demo"];
print "<br />";
# Demonstration of multiple filtering.
print @$_GET["Demo#1,10"];
print "<br />";
# Demonstration of various expressions.
# Using: @$_GET["key#exp[ available symbols by | delimiter ]"]
print @$_GET["Demo#exp[en|num|$|%]"];
print "<br />";
# Demonstration of form's protection,
# Using the option "allow to use main class as function".
# Using: @$_SecureLab( code );
# You can get the referance of this option of securelab.sourceforge.net/documentation/MainClass_As_Function_Codes.txt
if( $_POST() ) {
print "<form action=\"\" method=\"post\">";
print $_SecureLab("newformkey");
print "<input type=\"text\" style=\"border: solid 1px #EEEEEE;border-radius: 5px;padding: 8px;font: 16px Calibri;\" value=\"*nas%^5s7(hide@address.com\" name=\"text\"> <input type=\"submit\" style=\"background: #F2F2F2;font: 16px Calibri;border: solid 1px #CCCCCC;border-radius: 5px;padding: 7px;\" value=\" Send test form \">";
print "</form>";
} else {
# Introducing a new variable to get the error.
# Allowed using without additionl variable.
# NOTE: use the operator === to compare the function's returning values.
@ $FormVidation = $_SecureLab("validateform");
if( $FormVidation === true ) {
# Validation successfully passed.
echo "<span style=\"color:green;font: 18px Calibri;\">Current form is valid.</span><br />";
echo "<span style=\"font: 18px Calibri;\">FILTERED text form value: <b>" . $_POST["text"] . "</b></span>";
} else {
# Validation is wrong, printing the error on screen.
echo "<span style=\"color:red;font: 18px Calibri;\">Current form is not valid, error is <b>" . $FormVidation . "</b>.</span>";
}
}
# Calculating the final time of whole script executing.
# Will be showed as HTML comment.
echo "<!-- " . (microtime(true) - $LoadingDate) . " -->";
?>