Free Zend PHP Certification Exam Guide

Download the Free Zend PHP Certification Guide

http://downloads.zend.com/guides/php5.3/PHP_5-3_Study_Guide_v1a.pdf

 

Posted in PHP | Leave a comment

Simple Mail Function in PHP – Mail Program

Just change the Mail address from info@gmail.com to your own mail address and upload the code on server and its ready to use.

HTML CODE:

<form id=”form1″ name=”form1″ method=”post” action=”">
<table width=”500″ border=”0″ cellspacing=”0″ cellpadding=”10″>
<tr>
<td>Name</td>
<td><input type=”text” name=”name” id=”name” /></td>
</tr>
<tr>
<td>Email</td>
<td><input type=”text” name=”email” id=”email” /></td>
</tr>
<tr>
<td>Phone</td>
<td><input type=”text” name=”phone” id=”phone” /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type=”submit” name=”submit” id=”submit” value=”Submit” /></td>
</tr>
</table>
</form>

PHP CODE:

<?php
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];

$to=”info@gmail.com”;
$sub=”You got mail from $name”;
$body=”\n
Name: $name \n
Email: $email \n
Phone: $phone \n”;
$headers=”From: $email \r\n”;

if(mail($to,$sub,$body,$headers))
{
//Thankyou mail to sender

$to2=$email;
$sub2=”Thankyou $name”;
$body2=”Thanks for registraion”;
$headers2=”From:info@gmail.com \r\n”;
mail($to2,$sub2,$body2,$headers2);
}
else
{
echo “Mail not Sent”;
}
}
?>

Posted in PHP | Leave a comment

Random Password Generator Program in PHP

PHP CODE:

<?php
if(isset($_POST['generate']))
{
$string=”abcdefghijklmnaoprstABCDEFG01234567″;
$random=str_shuffle($string);
$final=substr($random,0,8);
}
?>

HTML CODE:

<form id=”form1″ name=”form1″ method=”post” action=”">
<p>
<input type=”submit” name=”generate” id=”generate” value=”Generate” />
</p>
<p>
<input type=”password” name=”pass” id=”pass” value=”<?php echo $final; ?>”/>
</p>
<p>
<input type=”text” name=”pass2″ id=”pass2″ value=”<?php echo $final; ?>” />
</p>
</form>

Posted in PHP | Leave a comment

Find and Replace Program in PHP

HTML CODE:
<form id=”form1″ name=”form1″ method=”post” action=”">
<p>
<textarea name=”mssg” id=”mssg” cols=”45″ rows=”5″><?php echo $final;?></textarea>
</p>
<p>
<input type=”submit” name=”submit” id=”submit” value=”Submit” />
</p>
</form>

PHP CODE:

<?php
if(isset($_POST['submit']))
{
$mssg=$_POST['mssg'];
$word=array(‘kill’,'murder’,'hang’);
$final=str_replace($word,”***”,$mssg);
echo $final;
}

?>

Posted in PHP | Leave a comment

Simple Hash Program in PHP

HTML CODE:

<form id=”form1″ name=”form1″ method=”post” action=”">
Enter Password:
<input type=”text” name=”pass” id=”pass” />
<input type=”submit” name=”submit” id=”submit” value=”Submit” />
</form>
PHP CODE:

<?php
echo sha1($_POST['pass']);
echo “<br>”;
echo md5($_POST['pass']);
?>

Posted in PHP | Leave a comment