Spark

PHP script to find Highest, lowest, count and average numbers in array

To find a highest, lowest, count and average numbers in an array Here, we find the sample php programs to find the find he highest number in an array, similarly lowest number in an array, count of the numbers in an array and average of the numbers in an array. <?php $array=array(‘1′,’2′,’3′,’4’); echo “Given array …

PHP script to find Highest, lowest, count and average numbers in arrayRead More »

PHP script for sample contact page for website

Contact page for website <?php include(‘config.inc.php’); class ContactUs { var $arrErrors = array(); var $strSuccess = ”; public $strSelect=null; public $objResult=null; var $objConfig = null; var $objDbConn=null; var $intRandSiteLimit = 35; var $arrRandSites = array(); var $strName = ”; var $strPhone = null; var $strEmail = ”; var $strContent = ”; var $strReferrer = null; …

PHP script for sample contact page for websiteRead More »

How to create user login, forgot password and logout page using php script

To create a login page in php Note: Create a table tbl_login with uname and pwd //config.inc.php <?php class Config { public $dbHostname = ‘localhost’; public $dbUsername = ‘root’; public $dbPassword = ‘xxx’; public $dbName = ‘dbname’; } ?> //index.php <?php session_start(); include(“config.inc.php”); class Login { public $strUsername = null; private $strPassword = null; public $arrErrors …

How to create user login, forgot password and logout page using php scriptRead More »

How to output or print the array results in php

To print an array result using var_dump() <?php $a = array(1, 2, array(“a”, “b”, “c”)); var_dump($a); ?> Note: var_dump() is used to dumb the information about the variable output array 0 => int 1 1 => int 2 2 => array 0 => string ‘a’ (length=1) 1 => string ‘b’ (length=1) 2 => string ‘c’ (length=1) To print an array result …

How to output or print the array results in phpRead More »

How to include Captcha in php program / script

sample captcha code //captcha.php <?php session_start(); if(isset($_REQUEST[‘submit’])) { if(isset($_REQUEST[“captcha”])&&$_REQUEST[“captcha”]!=””&&$_SESSION[“code”]==$_REQUEST[“captcha”]) { echo “Correct Code Entered”; //Do you stuff } else { echo “wrong code try again”; } } ?> <html> <body> <form action=”captcha.php” method=”post”> Enter Image Text <input name=”captcha” type=”text”> <img src=”captcha_img.php” /><br> <a href=”captcha.php”>Refresh</a> <input name=”submit” type=”submit” value=”Submit”> </form> </body> </html> Here is a php …

How to include Captcha in php program / scriptRead More »

Php script or program to find square root of a given number

Simple program to find square root of a given number <?php $num=9; $root=0; $odd=1; while($num>0) { $num-=$odd; $root++; $odd+=2; } echo $root; ?> output  3 Program to find square root of a given number using sqrt functions, classes and objects <?php class square { public $num=null; public $objRes=null; function processRequest() { $this->square=$_REQUEST[‘num’]; } function run() …

Php script or program to find square root of a given numberRead More »