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 … Read 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() … Read more

Categories PHP

PHP script to find the odd or even numbers

Here, we find simple php script to find the given number is odd or even. These are the basic programs used during PHP training for students. Simple program to find odd or even number <?php $num=$_REQUEST[‘num’]; if($num%2==0) { echo “Even number”; } else { echo “odd number”; } ?> <html> <body> <form action=”even.php” method=”post”> Enter … Read more

Categories PHP

How to install, setup and configure Wamp server

wamp

WAMP

WAMP is an acronym, where W stands for Windows, A stands for Apache, M stands for MYSQL,  P stands for PHP, which refers to set of open source application combined with microsoft windows, which are commonly used for web server environment.

Step 1:Installation

First have to download the latest version of WAMP server from http://www.wampserver.com/en/download.php . You will have the options to choose either 32-bit or 62-bit version your choice is based on your system configuration. After completion of downloading, extract the folder and run the .exe file.

 

wamp1

Click Next button, you will be asked to accept the license agreement. Accept it and go ahead.

Step 2: Specify a folder

Next step is to select where you would like to install a WAMP server. Default will be C:/wamp. If you want to install in some other directory is also possible.

wamp2

Step 3: Additional Task

After choosing the directory, it will provide the option to set up  icons.Select from the options whatever you need.

wamp3

Once completed click Next button and confirm the installation settings by clicking Install button.

Once the installation finish installing its files WAMP detects which is your default browser at that moment. Click No and choose any other browser you want. If your firewall pops up make sure to grant Apache access.

Step 4: PHP Mail Parameters

If you would like to have a mail parameters,  just you have to configure the SMPT server by clicking Next button.

wamp4

WAMP installed successfully message is displayed. Now you have to test the wamp server by starting it. Once the WAMP is started the small W icon is available in toolbar.

Note: If the  W icon is in red color means everything is stopped. If it is in green color means everything is running and if it is in orange color means some services are running.

Step 5: Check the installation

Now its time to check whether everything is installed correctly. Type localhost in browser, if you seen the following screen in your browser, then everything is working fine. Just you have to modify some files to access WAMP via the http:// localhost link.

wamp5

Open a WAMP management console highlight Apache and then click httpd.conf .Open in text editor and find the line ‘Allow from 127.0.0.1’ and add ‘Allow from ::1’ below it now. Then save the file and restart the server,then open localhost in browser.If you see the following screen in browser then everything is right.

wamp6

 

Note: If you want to provide password for your server, go to phpmyadmin in your folder and open config.inc.php file for editing and provide password.

Read more

how to install set up or configure Xampp server

XAMPP XAMPP is an acronym, where X stands for cross platform or any other operating system ,where A stands for Apache, M stands for MYSQL,  P stands for PHP and P stands for Perl. XAMPP is reliable and fast way to set up a environment for PHP programming. It provides all the components for developing, running and … Read more

How to get random number in php program or script

To get a random number using PHP function rand() function generates the random number Here is the code to print the random numbers from 1 t0 19 using array <?php $arr = array(1, 20, NULL); for ($i = 1; $i <20 ;$i += 1) { $arr[$i] = rand(1, 20); } for ($i = 1; $i … Read more

Categories PHP

What is responsive website templates or themes and benifits

What is Responsive website theme? A Responsive theme is simply means a website that has been developed and the contents, images and structure of the website remains the same in all the devices(such as desktop, smartphones, tablets etc.,).For example, if the user visits the site in desktop, the full view of the site is displayed. If … Read more