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
Forex Trading Online forex trading platform

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 : 10899
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>
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



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
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
PHP alternating the colors of table rows with style.
Categories : PHP, HTML and PHP, CSS
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
CSS style switcher
Categories : PHP, CSS, HTML and PHP, Arrays, Sessions
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
dynamic table columns
Categories : PHP, HTML and PHP, Arrays, Databases, MySQL
Pageinfo: Array containing page URI, page query string (parameters), request method (GET or POST) and the complete URI
Categories : Variables, PHP Options and Info, Arrays, URLs, PHP
PHP function which gets all the data from a webpage into a string, we can perform regular expression functions on that data afterwards to get our desired data.
Categories : PHP, URLs, HTML and PHP
GonxTabs : Create elegant HTML tabs based interface
Categories : Navigation, HTML, HTML and PHP, PHP