Progged programming site

Programming source code, articles, tutorials, links and chat

Archive for the 'PHP' Category

read contents of a directory

reads in the contents of a directory and display as links
<?function directory($result) {
$handle=opendir("".""); while ($file = readdir($handle)) { if ($file == ""."" || $file == "".."") { } else { print ""<a href=$file>$file</a><br>""; }
} closedir($handle); return $result; } echo directory($result); ?>

Bookmark It

Hide Sites

[ Back to top ]

Read an ini file

The contents of the ini file are listed below
[settings1] text1 = "hello" text2 = "world"
[settings2] number1 = 4 number2 = 8
//print out all of the contents of the test.ini file
<?php $ini_array = parse_ini_file("test.ini");print_r($ini_array);?>

Bookmark It

Hide Sites

[ Back to top ]

Email verify function

Email verify function with PHP
function checkEmail($address){if(ereg( ""^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)$"",$address) )return true;elsereturn false;}

Bookmark It

Hide Sites

[ Back to top ]

Image Resize

Resize images the easy way using PHP
<?php//image resizer by myscripting//get the size of the original$size = GetImageSize(""testimage.gif"");//store the resized dimensions in a variable$sizeh50 = $size[1]/2;$sizew50 = $size[0]/2;?>Original Image :<br><img src =""testimage.gif""><br>Resized image :<br><img src =""testimage.gif"" height=""<?php echo $sizeh50; ?>"" width =""<?php echo $sizew50;?>"">

Bookmark It

Hide Sites

[ Back to top ]

Sponsors