Sitemap

Php Programming Basic Info

PHP right now is the most powerfull script engine ..
It’s used in many web server in the world ..
PHP is very usefull to make web application ..
It has been proved by wordpress and wikipedia ..
For beginner who want to learn about php first you must install vertrigo :
http://vertrigo.sourceforge.net/ 
after you install to learn the basic , […]

Read More ...

How to make Cookies Expired

The difference between cookie and session is cookie is saved in client ( browser) but session is saved in server.
If you want to unset cookies you can not use unset function.
This code wil show how to make cookie expired
If you want to set how cookie expire in time you can use something like this […]

Read More ...

Generate Image Verification with PHP

Generate Image Verification is usually used to stop brute force attack in web application …
This code show how Generate Image Verification with PHP
<?
$str = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO1234567890″;
$randkey = substr(str_shuffle($str),0,7);
$image = imagecreatefromjpeg(”./image/test.jpg”);
$font = 9 ;
$black = imagecolorallocate($image,0,0,0);
$red = imagecolorallocate($image,100,0,0);
$y = (imagesy($image)-imagefontheight($font))/2;
$x = ((imagesx($image))/4);
imagestring($image,$font,$x,$y,$randkey,$black);
$font =3;
imagestring($image,$font,7,$y+20,”www.gunungpring.com”,$red);
header(”Content-type: image/jpeg”);
imagejpeg($image);
imagedestroy($image);
?>

Read More ...

Session Implementation

In PHP to use session you can use like this …
This is to set session …
<?php

session_start();$_SESSION[”mysession”] = “This is my session”;
?>
To acces session
<?php

session_start();echo $_SESSION[”mysession”];
?>
To Destroy session
<?

session_start();unset($_SESSION[”mysession”]);
session_destroy();
?>

Read More ...

Read filename in a directory

<?
$dir = “./data/”;
$dfile = opendir($dir) or die(’error’);
while (($f = readdir($dfile)) !== false)
{
if (is_file($dir.$f))
{
echo $f . “<BR>”;
}
}
?>

Read More ...