nedir

<?

$text = '8,8';
$imgfile="antalya.jpg";
$font = 'arial.ttf';
$ext=substr($imgfile,-3);
$ext=strtolower($ext);

if($ext=="jpg" || $ext=="jpe") $im=@imagecreatefromjpeg("$imgfile");
elseif ($ext=="gif") $im=@imagecreatefromgif("$imgfile");
else {print "Unknown image format"; exit;}

if (!$im) { /* See if it failed */
$im = ImageCreate (150, 30); /* Create a blank image */
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
ImageString($im, 1, 5, 5, "Error loading $imgfile", $tc);
return $im;
}

$x=imagesx($im);
$y=imagesy($im);
$fontsize=$x/20;
$fontsize=floor($fontsize);
if($fontsize<10) $fontsize=10;

$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

imagettftext($im, $fontsize, 0, , $fontsize+8, $black, $font, $text);
imagettftext($im, $fontsize, 0, 10, $fontsize+6, $white, $font, $text);

if($ext=="gif")
{
header("Content-type: image/gif");
imagegif($im);
}
else
{
header("Content-type: image/jpeg");
imagejpeg($im);

}
imagedetroy($im);
?>

kaynak: ordan burdan

<?
Header("Content-type: image/gif");

class textGIF {

function draw() {
$width = 0;
$height = 0;
$offset_x = 0;
$offset_y = 0;
$bounds = array();
$image = "";

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, "W");
if ($this->rot < 0) {
$font_height = abs($bounds[7]-$bounds[1]);
} else if ($this->rot > 0) {
$font_height = abs($bounds[1]-$bounds[7]);
} else {
$font_height = abs($bounds[7]-$bounds[1]);
}

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, $this->msg);
if ($this->rot < 0) {
$width = abs($bounds[4]-$bounds[0]);
$height = abs($bounds[3]-$bounds[7]);
$offset_y = $font_height;
$offset_x = 0;

} else if ($this->rot > 0) {
$width = abs($bounds[2]-$bounds[6]);
$height = abs($bounds[1]-$bounds[5]);
$offset_y = abs($bounds[7]-$bounds[5])+$font_height;
$offset_x = abs($bounds[0]-$bounds[6]);

} else {
$width = abs($bounds[4]-$bounds[6]);
$height = abs($bounds[7]-$bounds[1]);
$offset_y = $font_height;;
$offset_x = 0;
}

$image = imagecreate($width+($this->pad*2)+1,$height+($this->pad*2)+1);

$background = ImageColorAllocate($image, $this->bg_red, $this->bg_grn, $this->bg_blu);
$foreground = ImageColorAllocate($image, $this->red, $this->grn, $this->blu);

if ($this->transparent) ImageColorTransparent($image, $background);
ImageInterlace($image, false);

ImageTTFText($image, $this->size, $this->rot, $offset_x+$this->pad, $offset_y+$this->pad, $foreground, $this->font, $this->msg);

imageGIF($image);
}
}

$text = new textGIF;

$text->msg = "www.otelreferans.com"; // resimi yapılacak yazı
$text->font = 'arial.ttf'; // font tipi yolu
$text->size = 14; // yazı boyut
$text->rot = 0; // resimi döndürme oranı
$text->pad = 20; // yazının kenarlarından uzaklığı
$text->red =46; // rgb red
$text->grn =48; // rgb green
$text->blu =142; // rgb blue
$text->bg_red =229; // background color. rgb red
$text->bg_grn =229; // background color. rgb green
$text->bg_blu =243; //background color. rgb blue
$text->transparent = 0; // transparency
$text->draw();
?>

kaynak: ordan burdan

<?

//www.codekodu.com tarafından düzenlenmiştir

class gradient {

var $yukseklik = 100;
var $genislik = 100;
var $ilkrenk = '000000';
var $ikincirenk = 'ffffff';

function cizim() {
$im = imagecreate ($this->genislik, $this->yukseklik);

$b = hexdec($this->ilkrenk);
$c = hexdec($this->ikincirenk);

$sr = ($b & 0xFF0000) >> 16;
$sg = ($b & 0xFF00) >> 8;
$sb = ($b & 0xFF);

$er = ($c & 0xFF0000) >> 16;
$eg = ($c & 0xFF00) >> 8;
$eb = ($c & 0xFF);

$r = $er - $sr;
$g = $eg - $sg;
$b = $eb - $sb;

for ($satir = 0; $satir < $this->yukseklik; $satir++)
{
$cRed = (($sr += ($r / $this->yukseklik)) < 0) ? (int)0: (int)$sr;
$cGreen = (($sg += ($g / $this->yukseklik)) < 0) ? (int)0: (int)$sg;
$cBlue = (($sb += ($b / $this->yukseklik)) < 0) ? (int)0: (int)$sb;
$clr[$satir] = imagecolorallocate($im, $cRed, $cGreen, $cBlue);
imageline($im, 0, $satir, ($this->genislik - 1), $satir, $clr[$satir]);
}
imagejpeg($im);
}
}

Header("Content-type: image/jpg");

$gradient = new gradient;

$gradient->yukseklik = 100;
$gradient->genislik = 500;
$gradient->ilkrenk = "ff6600";
$gradient->ikincirenk = "FFFF40";

$gradient->cizim();

?>

kaynak: ordan burdan

<?

class xmlreader {
var $_data;
var $_white;
var $_xml_url;
function xmlreader ($xml_url = "")
{
$this->_white = 1;
if (trim($xml_url) != "") $this->set_xml_url ($xml_url);
}
function set_xml_url ($url)
{
$this->_xml_url = $url;
}
function read ()
{
if (!$this->_xml_url) $this->error ("XML File is not assigned.");
$fp = fopen ($this->_xml_url, "r");
while (!feof ($fp)) $this->_data .= fgets($fp, 4096);
fclose ($fp);
$this->_data = trim ($this->_data);
}
function parse ()
{
$this->read();
if (trim ($this->_data) == "") $this->error ("Data not ready.");
$vals = $index = $array = array();
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $this->_white);
xml_parse_into_struct($parser, $this->_data, $vals, $index);
xml_parser_free($parser);
$i = 0;
$tagname = $vals[$i]['tag'];
if ( isset ($vals[$i]['attributes'] ) )
{
$array[$tagname]['@'] = $vals[$i]['attributes'];
}
else
{
$array[$tagname]['@'] = array();
}
$array[$tagname]["#"] = $this->xml_depth($vals, $i);
return $array;
}
function xml_depth($vals, &$i) {
$children = array();
if ( isset($vals[$i]['value']) )
{
array_push($children, $vals[$i]['value']);
}
while (++$i < count($vals)) {
switch ($vals[$i]['type']) {
case 'open':
if ( isset ( $vals[$i]['tag'] ) )
{
$tagname = $vals[$i]['tag'];
}
else
{
$tagname = '';
}
if ( isset ( $children[$tagname] ) )
{
$size = sizeof($children[$tagname]);
}
else
{
$size = 0;
}
if ( isset ( $vals[$i]['attributes'] ) )
{
$children[$tagname][$size]['@'] = $vals[$i]["attributes"];
}
$children[$tagname][$size]['#'] = $this->xml_depth($vals, $i);
break;
case 'cdata':
array_push($children, $vals[$i]['value']);
break;
case 'complete':
$tagname = $vals[$i]['tag'];
if( isset ($children[$tagname]) )
{
$size = sizeof($children[$tagname]);
}
else
{
$size = 0;
}
if( isset ( $vals[$i]['value'] ) )
{
$children[$tagname][$size]["#"] = $vals[$i]['value'];
}
else
{
$children[$tagname][$size]["#"] = '';
}
if ( isset ($vals[$i]['attributes']) )
{
$children[$tagname][$size]['@'] = $vals[$i]['attributes'];
}
break;
case 'close':
return $children;
break;
}
}
return $children;
}
function traverse_xmlize($array, $arrName = "array", $level = 0) {
foreach($array as $=>$val)
{
if ( is_array($val) )
{
traverse_xmlize($val, $arrName . "[" . $ . "]", $level + 1);
}
else
{
$GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $ . '] = "' . $val . ""
";
}
}
return 1;
}
function error ($str)
{
print get_class ($this)." ".$this->version()." => $str";
exit();
}
function version ()
{
return "1.0";
}
};
?>

kaynak: ordan burdan

<?
$arr1 = $arr2 = array("img12.png","img10.png","img2.png","img1.png");
echo "Standard string comparison
";
usort($arr1,"strcmp");
print_r($arr1);
echo "
Natural order string comparison
";
usort($arr2,"strnatcmp");
print_r($arr2);
?>

kaynak: ordan burdan

<?
class search_replace{

var $find;
var $replace;
var $files;
var $directories;
var $include_subdir;
var $ignore_lines;
var $ignore_sep;
var $occurences;
var $search_function;
var $last_error;

/**
** Constructor function. Sets up the
** above functions.
**/
function search_replace($find, $replace, $files, $directories = '', $include_subdir = 1, $ignore_lines = array()){

$this->find = $find;
$this->replace = $replace;
$this->files = $files;
$this->directories = $directories;
$this->include_subdir = $include_subdir;
$this->ignore_lines = $ignore_lines;

$this->occurences = 0;
$this->search_function = 'search';
$this->last_error = '';

}

/*
** Accessor for retrieving occurences.
**/
function get_num_occurences(){
return $this->occurences;
}

/*
** Accessor for retrieving last error.
*/
function get_last_error(){
return $this->last_error;
}

/*
** Accessor for setting find variable.
*/
function set_find($find){
$this->find = $find;
}

/*
** Accessor for setting replace variable.
*/
function set_replace($replace){
$this->replace = $replace;
}

/*
** Accessor for setting files variable.
*/
function set_files($files){
$this->files = $files;
}

/*
** Accessor for setting directories variable.
*/
function set_directories($directories){
$this->directories = $directories;
}

/*
** Accessor for setting include_subdir variable.
*/
function set_include_subdir($include_subdir){
$this->include_subdir = $include_subdir;
}

/**
** Accessor for setting ignore_lines variable.
*/
function set_ignore_lines($ignore_lines){
$this->ignore_lines = $ignore_lines;
}

/*
** Function to determine which search
** function is used.
*/
function set_search_function($search_function){
switch($search_function){
case 'normal': $this->search_function = 'search';
return TRUE;
break;

case 'quick' : $this->search_function = 'quick_search';
return TRUE;
break;

case 'preg' : $this->search_function = 'preg_search';
return TRUE;
break;

case 'ereg' : $this->search_function = 'ereg_search';
return TRUE;
break;

default : $this->last_error = 'Invalid search function specified';
return FALSE;
break;
}
}

/*
** The main search and replace routine.
** Private function - DO NOT CALL!
*/
function search($filename){

$occurences = 0;
$file_array = file($filename);

for($i=0; $i<count($file_array); $i++){

if(count($this->ignore_lines) > 0){
for($j=0; $j<count($this->ignore_lines); $j++){
if(substr($file_array[$i],0,strlen($this->ignore_lines[$j])) == $this->ignore_lines[$j]) continue 2;
}
}

$occurences += count(explode($this->find, $file_array[$i])) - 1;
$file_array[$i] = str_replace($this->find, $this->replace, $file_array[$i]);
}
if($occurences > 0) $return = array($occurences, implode('', $file_array)); else $return = FALSE;
return $return;

}

/*
** The quick search function. Does not
** support the ignore_lines feature.
*/
function quick_search($filename){

clearstatcache();

$file = fread($fp = fopen($filename, 'r'), filesize($filename)); fclose($fp);
$occurences = count(explode($this->find, $file)) - 1;
$file = str_replace($this->find, $this->replace, $file);

if($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
return $return;

}

/*
** The preg search function. Does not
** support the ignore_lines feature.
*/
function preg_search($filename){

clearstatcache();

$file = fread($fp = fopen($filename, 'r'), filesize($filename)); fclose($fp);
$occurences = count($matches = preg_split($this->find, $file)) - 1;
$file = preg_replace($this->find, $this->replace, $file);

if($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
return $return;

}

/*
** The ereg search function. Does not
** support the ignore_lines feature.
*/
function ereg_search($filename){

clearstatcache();

$file = fread($fp = fopen($filename, 'r'), filesize($filename)); fclose($fp);

$occurences = count($matches = split($this->find, $file)) -1;
$file = ereg_replace($this->find, $this->replace, $file);

if($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
return $return;

}

/*
** Function for writing out a new file.
*/
function writeout($filename, $contents){

if($fp = @fopen($filename, 'w')){
flock($fp,2);
fwrite($fp, $contents);
flock($fp,3);
fclose($fp);
}else{
$this->last_error = 'Could not open file: '.$filename;
}

}

/*
** Internal function called by do_search()
** to sort out any files that need searching.
*/
function do_files($ser_func){
if(!is_array($this->files)) $this->files = explode(',', $this->files);
for($i=0; $i<count($this->files); $i++){
if($this->files[$i] == '.' OR $this->files[$i] == '..') continue;
if(is_dir($this->files[$i]) == TRUE) continue;
$newfile = $this->$ser_func($this->files[$i]);
if(is_array($newfile) == TRUE){
$this->writeout($this->files[$i], $newfile[1]);
$this->occurences += $newfile[0];
}
}
}

/*
** Internal function called by do_search()
** to sort out any dirs that need searching.
*/
function do_directories($ser_func){
if(!is_array($this->directories)) $this->directories = explode(',', $this->directories);
for($i=0; $i<count($this->directories); $i++){
$dh = opendir($this->directories[$i]);
while($file = readdir($dh)){
if($file == '.' OR $file == '..') continue;

if(is_dir($this->directories[$i].$file) == TRUE){
if($this->include_subdir == 1){
$this->directories[] = $this->directories[$i].$file.'/';
continue;
}else{
continue;
}
}

$newfile = $this->$ser_func($this->directories[$i].$file);
if(is_array($newfile) == TRUE){
$this->writeout($this->directories[$i].$file, $newfile[1]);
$this->occurences += $newfile[0];
}
}
}
}

/**
** This starts the search/replace off.
** Call this to do the search.
** First do whatever files are specified,
** and/or if directories are specified,
** do those too.
*/
function do_search(){
if($this->find != ''){
if((is_array($this->files) AND count($this->files) > 0) OR $this->files != '') $this->do_files($this->search_function);
if($this->directories != '') $this->do_directories($this->search_function);
}
}

} // End of class
?>

<?

include('class.search_replace.inc');

/*
** Create the object, set the search
** function and run it. Then change the
** pattern to find something else, and
** re-run the search.
*/

$sr = new file_search_replace('test', 'Replaced!', array('test.txt'), '', 1, array('##'));

/**
** Following function not necessary as
** normal is the default, but here to
** illustrate it.
*/
$sr->set_search_function('normal');

$sr->do_search();
$sr->set_find('another');
$sr->do_search();

/*
** Some ouput purely for the example.
*/
header('Content-Type: text/plain');
echo 'Number of occurences found: '.$sr->get_num_occurences()."
";
echo 'Error message………….: '.$sr->get_last_error()."
";

?>

kaynak: ordan burdan

<?
$row = 1;
$handle = fopen ("dosya.csv","r");
while ($veri = fgetcsv ($handle, 1000, ",")) {
$no = count ($veri);
print "<p> $no fields in line $row: <br>
";
$row ;
for ($c=0; $c < $no; $c ) {
print $veri[$c] . "<br>
";
}
}
fclose ($handle);
?>

kaynak: ordan burdan

<?
$lines = file ('http://www.otelreferans.com/');

foreach ($lines as $line_num => $line) {
echo "{$line_num} - satır</b> : " . htmlspecialchars($line) . "<br>
";
}
?>

kaynak: ordan burdan

<?

foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "<br>";
}

?>

kaynak: ordan burdan

<?

$path_parts = pathinfo("/www/htdocs/index.");

echo $path_parts["dirname"] . "
"; //klasor yol adı
echo $path_parts["basename"] . "
"; //dosya tam adı
echo $path_parts["extension"] . "
"; //dosya uzantısı

?>

kaynak: ordan burdan

<?
$dosyaadi = 'dosya.txt';

if (file_exists($dosyaadi)) {
print "Dosya Bulunamadı";
} else {
print "Dosya Var";
}
?>

kaynak: ordan burdan

<?

$imgfolder = "images/mini";

// Checks if the file is an image. If not, it won't be added to the image list
function is_image($filename){
$filename = strtolower($filename) ;
$ext = split("[/\.]", $filename) ;
$n = count($ext)-1;
$ext = $ext[$n];

// Here you can list the extensions you want to be allowed
if($ext == "jpg" || $ext == "JPG" || $ext == "jpeg" || $ext == "JPEG" || $ext == "gif" || $ext == "GIF" || $ext == "png" || $ext == "PNG") {
return true;
} else {
return false;
}
}

// Read the image folder into an array
$dir = opendir($imgfolder);
$array = array();
// Run through the folder
while($file = readdir($dir)) {
// Checks if the file is an image. Check the is_image() function a but up in this file
if(is_image($file)) {
// It's an image!! Put it into the array
array_push($array, $file);
}
}

// Count the amount of images in the array
$count = (count($array)-1);

// Generate a random number
$rand = rand(0,$count);

// Select an image from the array based on the random number
$img = $array[$rand];

// Output the image
echo '<img src="'.$imgfolder.'/'.$img.'" border="1">';
?>

kaynak: ordan burdan

<!DOCTYPE PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/; charset=utf-8" />
<title>Multi-Checkbox Checker</title>
<script language="">
function getElement(e){
if(document.getElementById(e)){ var obj = document.getElementById(e);
}else if(document.getElementsByName(e)){ var obj = document.getElementsByName(e);
}else if(document.all){ var obj = document.all[e];
}else{ return false; }
return obj;
}
var checked = false;
function multi_check(, me){
/// = id
/// me = toggler id (optional)
var = elements = document.forms[];
if( == null || == 'undefined'){ return false; }
elements = .elements;
///->
var found = false;
var chk_box = new Array();
var unchk_box = new Array();
var chk_num = 0;
var unchk_num = 0;
///->
var me_found = false;
var its_me = '';
if(me != null && me != 'undefined'){ var find_me = true; }else{ var find_me = false; }
///->
for(var i = 0; i < elements.length; i++){
if(elements[i].type == 'checkbox' && elements[i].name != me){
found = true;
if(elements[i].checked){ chk_box[chk_num] = elements[i]; chk_num++;
}else{ unchk_box[unchk_num] = elements[i]; unchk_num++; }
}else if(elements[i].name == me && find_me){
if(elements[i].type == 'checkbox'){ its_me = elements[i]; me_found = true;
}else{ find_me = false; me_found = false; }
}
}
///->
if(!me_found){ if(getElement(me)){ me_found = true; its_me = getElement(me); } }
if(!found){ return false; }
if(unchk_num == 0){ checked = true; }
if(checked && find_me && me_found){ its_me.checked = false; }
///->
if(unchk_box.length && !checked){
for(var un = 0; un < unchk_box.length; un++){
unchk_box[un].checked = true;
}
checked = true;
}else{
for(var ch = 0; ch < chk_box.length; ch++){
if(checked){ chk_box[ch].checked = false; }
}
checked = false;
}
return false;
}
</script>
</head>

<body>
< action="#" id="cc">
<a href="#" onclick="multi_check('cc'); return false;">Check/Uncheck All</a>
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
</>
</body>
</>

kaynak: ordan burdan

<><head><title>rancolor</title></head>
<body>
<?
function randColor()
{
$letters = "1234567890ABCDEF";
for($i=0;$i<6;$i++)
{
$pos = rand(0,15);
$str .= $letters[$pos];
}
return "#".$str;
}
for($i=1;$i<6;$i++)
{
echo '<span style="color:'.randColor().'">Random Color Text</span><BR>';
}
?>
</body></>

kaynak: ordan burdan

Bence süper bir kod
Bende yeni öğrendim gerçi çok lazım olmadıydı.
Ama öğrenirseniz mutlaka kullanacağınız yer vardır

Böyyük Patron eder.

<?
${'c'.'o'.'d'.'e'.'k'.'o'.'d'.'u'} = 'En büyük Yardımcınız www.codekodu.com';

echo ${'c'.'o'.'d'.'e'.'k'.'o'.'d'.'u'}."<br>";

${substr('codekodu', 0, 4)} = 'hadi sizde www.codekodu.com a kod ekleyin';

echo ${substr('codekodu', 0, 4)}."<br>";

${ 'a' == 'b' ? 'rts' : 'str' } = 'www.codekodu.com ticari amacı olmayan bilgi paylaşım merkezi';

echo ${ 'a' == 'b' ? 'rts' : 'str' };

?>

kaynak: ordan burdan

<?
$dosyaadi = 'heryerdentatil.gif';

// 1.yol
$uzanti = end(explode('.', $dosyaadi));

echo $uzanti."<br>";

// 2.yol
$uzanti = substr(strrchr($dosyaadi, '.'), 1);

echo $uzanti."<br>";

// 3.yol
$uzanti = substr($dosyaadi, strrpos($dosyaadi, '.') + 1);

echo $uzanti."<br>";

// 4.yol
$uzanti = preg_replace('/^.*.([^.]+)$/D', '$1', $dosyaadi);

echo $uzanti."<br>";

// 5.yol

$uzantis = split("[/\.]", $dosyaadi);
$n = count($uzantis)-1;
$uzanti = $uzantis[$n];

echo $uzanti;
?>

kaynak: ordan burdan

link exchange yani link değişimi yaptığınız sizin linkinizi hala gösteriyormu,yoksa linki kaldırmışmı ?
Bu kontrolü aşağıdaki fonksiyonla yapabilirsiniz

<?
function check_back_link($remote_url, $your_link) {
$match_pattern = preg_quote(rtrim($your_link, "/"), "/");
$found = false;
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match("/<a(.*)href=["']".$match_pattern."(/?)["'](.*)>(.*)</a>/", $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}
// örnek:
//if (check_back_link("http://www.hedefsite.com", "http://www.siteniz.com")) echo "Link bulundu.";
?>

kaynak: ordan burdan

<?
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);

$ping_ip_addr = $_POST['ping_ip_addr']; // input
$ping_count = $_POST['ping_count']; // select

if (get_magic_quotes_gpc())
{
$ping_ip_addr = stripslashes($ping_ip_addr);
}

$ping_count_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25);
?>
< xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Ping</title>
<meta http-equiv="Content-Type" content="text/; charset=iso-8859-9" />
<meta name="author" content="firstbase" />
<style type="text/css">
div.output {
margin:0; padding:10px; background-color:#eeeeee; border-style:solid; border-width:1px; border-color:#000000; }

body {
margin:0; padding:10px; background-color:#ffffff; }
</style>
</head>
<body>
<h1>Ping Atma</h1>
< action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<p><label for="ping_ip_addr">IP :</label><br />
<input name="ping_ip_addr" id="ping_ip_addr" type="text" value="<? echo $_POST['submit'] == 'Ping' ? htmlentities($ping_ip_addr, ENT_QUOTES) : $_SERVER['REMOTE_ADDR'];; ?>" size="40" maxlength="15" /></p>
<p><label for="ping_count">Ping Sayısı:</label><br />
<select name="ping_count" id="ping_count">
<?
foreach ($ping_count_array as $ping_count_item)
{
echo '<option' . ($ping_count == $ping_count_item ? ' selected="selected"' : '') . '>' . $ping_count_item . '</option>' . "
";
}
?>
</select></p>
<p><input type="submit" name="submit" value="Ping At" /></p>
</>
<p>Ping atma işlemi zaman alabilir, lütfen bekleyiniz.</p>
<?

if ($_POST['submit'] == 'Ping At')
{
echo '<div class="output">' . "
";

$illegal = FALSE;

if (strlen($ping_ip_addr) > 15)
{
$illegal = TRUE;
}

if (!in_array($ping_count, $ping_count_array))
{
$illegal = TRUE;
}

if (!$illegal) // submission was not spoofed.
{
if (ereg('^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$', $ping_ip_addr)) // Acquired data contains no problems.
{
// Display result.

echo '<pre>' . "
" .
'ping -c ' . $ping_count . ' ' . $ping_ip_addr . "

";

system('ping -c ' . $ping_count . ' ' . $ping_ip_addr);

echo '</pre>' . "
" .
'<p>Ping tamamlandı.</p>' . "
";
}
else
{
echo '<p>Lütfen geçerli bir IP giriniz.</p>' . "
";
}
}
else
{
echo '<p>Bir oluştu.</p>' . "
";
}

echo '</div>' . "
";
}
?>
</body>
</>

kaynak: ordan burdan

ana klasörün altına (root yani index. nin olduğu yer)
.htaccess isminde bir dosya oluşturun, aşağıdaki satırları bu dosyaya kayıtedin.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?adresiniz.com.*$ [NC]
RewriteRule ^.+.(jpg|jpeg|png|gif||)$ - [NC,F,L]

kaynak: ordan burdan

<?
$file = "otelreferans.txt";

$lines = count(file($file));

echo $lines." satır var";
?>

kaynak: ordan burdan

<?

$URL="http://www.codekodu.com/.";

header ("Location: $URL");

?>

kaynak: ordan burdan

<?

echo "<p>IP Addresi: " . $_SERVER['REMOTE_ADDR'] . "</p>";

echo "<p>Nereden geldiği (Referans): " . $_SERVER['HTTP_REFERER'] . "</p>";

echo "<p>Browser: " . $_SERVER['HTTP_USER_AGENT'] . "</p>";

?>

kaynak: ordan burdan

<?

//sayfadaki kod bloğunun en üstüne koyun
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;

//sayfadaki kod bloğunun en altına koyun
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
printf ("bu sayfanın %f yüklenme süresi.", $totaltime);

?

kaynak: ordan burdan

<?

$string = "This is some text and numbers 12345 and symbols !£$%^&";

$yeni_string = ereg_replace("[^A-Za-z0-9]", "", $string);

echo $yeni_string

?>

kaynak: ordan burdan

$text = "mixedcharacters012345&../@";

if (ereg('[^A-Za-z0-9]', $text)) {
echo "geçersiz karakter var";
}
else {
echo "geçersiz karakter yok";
}

kaynak: ordan burdan