WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables Update Picture
Ovidiu EFTIMIE
Date : Feb 15th 2001
Grade : 2 of 5 (graded 4 times)
Viewed : 12004
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Ovidiu EFTIMIE
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php
/****************************************************************
*Author: Ovidiu EFTIMIE
*Copyright:Ovidiu EFTIMIE
*Last modified:Friday, November 03, 2000 10:43:17 AM
*Description : Checks an array to see if it contains invalid chars
*****************************************************************/
class paranoia{
var
$wrongParams=false;
var
$para=array("~","`","!","@","#","\$","%","^","&","*","(",")","_","-","+","=","|",
               
"\\","{","}",":",";","\"","'",",","<",".",">","?","/");
/**************************************************
*Class constructor
*Params : $paramsArray - the array containing the data to be checked
***************************************************/
function paranoia($paramsArray){
reset($this->para);
$this->wrongParams=false;
while(list(
$k,$postvars)=each($paramsArray)){
    if(
is_array($postvars)){
        while(list(
$r,$postvals)=each($postvars)){
            while(list(,
$val)=each($this->para)){
               
$wrong=strchr($postvals,$val);
                if(!empty(
$wrong)){
                   
$this->wrongParams=true;
                }
            }
        }
    }else{
        while(list(,
$val)=each($this->para)){
           
$wrong=strchr($postvars,$val);
                if(!empty(
$wrong)){
               
$this->wrongParams=true;
                }
        }
       
reset($this->para);
    }
}
return
$this->wrongParams;
}
/*******************************************************
*Checks to see the invalid chars
********************************************************/
function checkParanoia(){
echo
date("d M Y H:i:s",time())."<br>Checking paranoia chars...<br><br>";
    while(list(
$d,$r)=each($this->para)){
        echo
$d.".   <b>".$r."</b>  =  <b>".ord($r)."</b><br>";
    }
}
/********************************************************
*Redirecting function
********************************************************/
function sendBack(){
echo
'<html><head><title></title></head><body onLoad="javascript:history.back(-1);"></body></html>';
}
}
?>
=================================================
Example
=================================================
<?php
require_once("paranoia.php");
if(isset(
$HTTP_POST_VARS)&&!empty($HTTP_POST_VARS)){
$par=new paranoia($HTTP_POST_VARS);
if(!empty(
$par->wrongParams)){
//    $par->sendBack();
   
echo "Incorrect parameters";
}else{
    echo
"Corect parameters";
}
}
?>
<html>
<head><title>Test page for paranoia</title></head>
<form action="test_paranoia.php" method="POST">
    <input type="text" name="test">
    <input type="submit" value="Test">
</form>
</html>



PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
Simple script to passing persistent and growing array between recalls of one page (manipulate little stack).
Categories : Arrays, Global Variables, PHP, HTML and PHP, Variables
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL
A class to put get and post variables in hidden form elements. Works on scalars, normal arrays, associative arrays.
Categories : Algorithms, Variables, Arrays, PHP, PHP Classes
Paginating the mySQL data
Categories : PHP, Algorithms, Databases, MySQL, HTML and PHP
Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with PHP 4.2.0
Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables
TreeView - Finally a working tree view function to be used as you want. Simple create the Table using the code provided and you will be able to have a tree view in your project. Download the zip to get the images.
Categories : PHP, HTML and PHP, Navigation
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
This script allows people to add their favorite quotes to your website. This could easily be modified to be a guestbook script or comment page script.
Categories : PHP, Complete Programs, HTML and PHP, Misc
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
Produces browser-safe strings while preserving HTML tags.
Categories : Strings, HTTP, PHP, HTML and PHP
Function to convert Arabic numbers into Roman Numerals
Categories : Algorithms, PHP, Date Time
Amazon book cover handling
Categories : HTML and PHP, PHP, MySQL, Ecommerce
This functions compares the current PHP version with a desired version. Because of the 3 tiered version system, a direct compare of a string to phpversion() will not be accurate.
Categories : PHP Configuration, PHP, Variables