Location: PHPKode > projects > Prsaar Social Networking Platform > PrsaarColour-0.7.alpha.6.3/pr-inside/validate.php
<?php
require_once('convert-to-html.php');
class Validate
{
	var $Error = false;
	
	//check e-mails-----------------------------------------
	function Email($Email, $Empty = false)
	{
		//is email is empty
		if($Empty == false)
		{
			if(empty($Email))
			{
				$this->Error = 'E-mail is empty';
				return false;
			}
		}
		else
		{
			if(!isset($Email))
			{
				$this->Error = 'E-mail is not set';
				return false;
			}
		}
		//how to check an email?
		return $Email;
	}
	
	//check string------------------------------------------
	function String($String, $Html = true, $Empty = false)
	{
		//is the string empty?
		if($Empty == false)
		{
			if(empty($String))
			{
				$this->Error = 'String is empty';
				return false;
			}
		}
		else
		{
			if(!isset($String))
			{
				$this->Error = 'String is not set';
				return false;
			}
		}
		//convert string in safe html
		$String = ConvertToHtml($String, $Html);
		return $String;
	}
	
	//check URL---------------------------------------------
	function URL($URL, $Empty = false)
	{
		//is the url empty?
		if($Empty == false)
		{
			if(empty($URL))
			{
				$this->Error = 'URL is empty';
				return false;
			}
		}
		else
		{
			if(!isset($URL))
			{
				$this->Error = 'URL is not set';
				return false;
			}
		}
		return $URL;
		//how to check a url
	}
}

//initialize an object Check
$Check = new Validate;
?>
Return current item: Prsaar Social Networking Platform