<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kesdi Hane' ye Hoşgeldiniz &#187; PHP</title>
	<atom:link href="http://blog.kesdi.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kesdi.com</link>
	<description>Kestane'ye Hoşgeldiniz</description>
	<lastBuildDate>Mon, 12 Dec 2011 06:57:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Online PHP Şifreleme</title>
		<link>http://blog.kesdi.com/php/online-php-sifreleme/</link>
		<comments>http://blog.kesdi.com/php/online-php-sifreleme/#comments</comments>
		<pubDate>Thu, 20 May 2010 08:56:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Sayfaları]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[encyript]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=514</guid>
		<description><![CDATA[http://www.byterun.com/free-php-encoder.php adresine girip, epostanızı girerek send me login-id şeklinde talepte bulunursanız, online php şifreleyen sayfaya girişiniz için bir şifre gönderiliyor. Bu şifre ile php kodlarınızı online şifreleyebiliyorsunuz. Çok profesyonel olmayan şifrelemeler için kullanılabilir.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.byterun.com/free-php-encoder.php">http://www.byterun.com/free-php-encoder.php</a> adresine girip, epostanızı girerek send me login-id şeklinde talepte bulunursanız, online php şifreleyen sayfaya girişiniz için bir şifre gönderiliyor. Bu şifre ile php kodlarınızı online şifreleyebiliyorsunuz.</p>
<p>Çok profesyonel olmayan şifrelemeler için kullanılabilir.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fonline-php-sifreleme%2F&amp;title=Online%20PHP%20%C5%9Eifreleme" id="wpa2a_2">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/online-php-sifreleme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php ile online uyeler</title>
		<link>http://blog.kesdi.com/php/php-ile-online-uyeler/</link>
		<comments>http://blog.kesdi.com/php/php-ile-online-uyeler/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 20:37:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[online üyeler]]></category>
		<category><![CDATA[sayfadaki online üyeler]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=461</guid>
		<description><![CDATA[Sayfalarda, online üyeleri nasıl yazdırabiliriz? Mantık basit, sayfa refresh edildiğinde 10 dakika ( yada belli bir zaman) içinde sayfaya girmiş üye isimlerini sayfada farzedip, isimlerini yazdırmamız gerekiyor. Öncelikle oturumumuzu başlatıyoruz. Sonra $sure isimli değişkene bundan yaklaşık 10 dk öncesini alıyoruz. time() fonksiyonu çalıştırıldığı anın saniye cinsinden verisini bize verir. Sanıyorum 1 Ocak 1970′ den beri [...]]]></description>
			<content:encoded><![CDATA[<p>Sayfalarda, online üyeleri nasıl yazdırabiliriz? Mantık basit, sayfa refresh edildiğinde 10 dakika ( yada belli bir zaman) içinde sayfaya girmiş üye isimlerini sayfada farzedip, isimlerini yazdırmamız gerekiyor.<br />
<span id="more-461"></span></p>
<pre class="brush: plain; title: ; notranslate">
session_start();
function online() {
//MYSQL BAGLANTI KODLARI
$sure = time()-600;
$uye = $_SESSION[&quot;nick&quot;];
$mysql = mysql_query(&quot;update online set zaman='time()' where uye='$uye'&quot;);
$sorgu = mysql_query(&quot;Select uye from online where zaman&gt;='$sure'&quot;);
while ($sonuc=mysql_fetch_array($sorgu)){
echo &quot;&lt;a href='$sonuc[0]'&gt;&quot;.$sonuc[0].&quot;&lt;/a&gt;&quot;;
}
$mysql = mysql_query(&quot; delete from online where zaman&lt;'$sure'&quot;);
}
</pre>
<p>Öncelikle oturumumuzu başlatıyoruz. Sonra $sure isimli değişkene bundan yaklaşık 10 dk öncesini alıyoruz. time() fonksiyonu çalıştırıldığı anın saniye cinsinden verisini bize verir. Sanıyorum 1 Ocak 1970′ den beri olan sürenin…</p>
<p>Neyse biz 1 dk = 60 sn orantısından 60*10 = 600 sn elde ediyoruz ve time() verisinden çıkarıyoruz. Bu sayede kodun çalıştırıldığı andan 10 dk öncesi elde edilmiş oluyor. Sonrasında kullanıcının nick verisini alıyoruz ve veritabanından kullanıcıyı seçip zaman isimli verisini şu andaki saniye ile değiştiyoruz. Hemen ardından mysql veritabanından zaman isimli sütunu şu andaki $sure yani normal andan 10 dk öncesi şeklinde bir şartla çağırıyoruz.</p>
<p>Yukarıdaki teknik sayesinde zaman isimli sütunu 10 dk öncesinden geri kalanlar alınmıyor ve sistemden düşmüş kabul ediliyor. Onun ardından seçilen kişiler tek tek yazdırılıyor.</p>
<p>Bunun dışında bizim istediğimiz zaman dışında kalanlar fazlalık yaratmasın diye veritabanından siliyor…</p>
<p><strong>Peki bu kodları nasıl çalıştırıcaz?</strong></p>
<p>Arkadaşlar kodlar fonksiyon haline getirilmiş durumda ki heryerde rahatça kullanılabilsin. İşte bu yüzden biz de fonksiyonu çağırıyoruz;</p>
<pre class="brush: plain; title: ; notranslate">
&lt;span style=&quot;MARGIN-LEFT: 0px !important&quot;&gt;&lt;code&gt;online();&lt;/code&gt;&lt;/span&gt;
</pre>
<p>online isimli tabloya 2 alan eklemeyi unutmayın <img src='http://blog.kesdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE `online` (
  `uye` text NOT NULL,
  `zaman` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5;
</pre>
<p><em>Kaynak : </em><a title="Bir Öğrenci Klasiği" href="http://www.birogrenciklasigi.com/php-ile-online-uyeler.html" target="_blank"><em>Bir Öğrenci Klasiği</em></a><br />
<em>Not: Yazının kendisine ait olduğunu öğrendikten sonra Ertuğrul arkadaşımızın sayfasını gezdim ve çok beğendim. Mutlaka gezmenizi tavsiye ediyorum. </em><a title="Bir Öğrenci Klasiği" href="http://www.birogrenciklasigi.com" target="_blank"><em>http://www.birogrenciklasigi.com</em></a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fphp-ile-online-uyeler%2F&amp;title=php%20ile%20online%20uyeler" id="wpa2a_4">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ile-online-uyeler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Php ile saldırıları önlemek</title>
		<link>http://blog.kesdi.com/php/php_ile_saldirilari_onlemek/</link>
		<comments>http://blog.kesdi.com/php/php_ile_saldirilari_onlemek/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 22:20:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=419</guid>
		<description><![CDATA[Php ile flood saldırılarından korunmak Kullanım Şekli]]></description>
			<content:encoded><![CDATA[<p>Php ile flood saldırılarından korunmak<span id="more-419"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

// ----------------------------------------------------------------------------
//
// class.floodblocker.php - FloodBlocker class, ver.0.01 (April 15, 2005)
//
// Description:
//   Class allowing to protect the scripts from flooding and to prevent
//   automatic download of the site from single IP.
//
// Author:
//   Vagharshak Tozalakyan &lt;&lt;a href=&quot;mailto:vagh@armdex.com&quot;&gt;vagh@armdex.com&lt;/a&gt;&gt;
//   This module was written by author on its leasure time.
//
// Warning:
//   This class is non commercial, non professional work. It should not have
//   unexpected results. However, if any damage is caused by this class the
//   author can not be responsible. The use of this class is at the risk of
//   the user.
//
// Requirements:
//   PHP &gt;= 4.1.0
//
// ----------------------------------------------------------------------------
// Errors and warnings

define ( 'E_TMP_DIR',    'Incorrect temprorary directory specified.' );
define ( 'E_IP_ADDR',    'Incorrect IP address specified.' );
define ( 'E_LOG_FILE',   'Log file access error! Check permissions to write.' );
define ( 'E_CRON_FNAME', 'The name of cron file must begin with dot.' );
define ( 'E_CRON_FILE',  'Cron file access error! Check permissions to write.' );
define ( 'E_CRON_JOB',   'Unable to perform the cron job.' );
// Class definition

class FloodBlocker
{

  // The directory where log files will be saved. Must have permissions to write.
  var $logs_path;

  // IP address of current connection. REMOTE_ADDR will be used by default.
  var $ip_addr;

  // An associative array of [$interval=&gt;$limit] format, where $limit is the
  // number of possible requests during $interval seconds.
  var $rules;

  // The name of the cron file. Must begin with dot. Default filename is '.time'.
  var $cron_file;

  // Cron execution interval in seconds. 1800 secs (30 mins) by default.
  var $cron_interval;

  // After how many of seconds to consider a file as old? By default the files
  // will consider as old after 7200 secs (2 hours).
  var $logs_timeout;
  /*
    Description:
      Class constructor.
    Prototype:
      void FloodBlocker ( string logs_path, string ip = '' )
    Parameters:
      logs_path - the directory where log files will be saved
      ip - the ip address of the current connection,
           $_SERVER['REMOTE_ADDR'] will be used if ip=''
  */
  function FloodBlocker ( $logs_path, $ip = '' )
  {

    if ( ! is_dir ( $logs_path ) )
      trigger_error ( E_TMP_DIR, E_USER_ERROR );

    $logs_path = str_replace ( '\\', '/', $logs_path );
    if ( substr ( $logs_path, -1 ) != '/' )
      $logs_path .= '/';

    $this-&gt;logs_path = $logs_path;

    if ( empty ( $ip ) )
      $ip = $_SERVER['REMOTE_ADDR'];

    $ip = ip2long ( $ip );
    if ( $ip == -1 || $ip === FALSE )
      trigger_error ( E_IP_ADDR, E_USER_ERROR );

    $this-&gt;ip_addr = $ip;

    $this-&gt;rules = array ( );
    $this-&gt;cron_file = '.time';
    $this-&gt;cron_interval = 1800;  // 30 minutes
    $this-&gt;logs_timeout = 7200;  // 2 hours

  }
  /*
    Description:
      Used to check flooding. Generally this function acts as private method
      and will be called internally by public methods. However, it can be called
      directly when storing logs in db.
    Prototype:
      bool RawCheck ( array &amp;info )
    Parameters:
      info - $interval=&gt;$time, $interval=&gt;$count array
    Return:
      FALSE if flood detected, otherwise - TRUE.
  */
  function RawCheck ( &amp;$info )
  {

    $no_flood = TRUE;

    foreach ( $this-&gt;rules as $interval=&gt;$limit )
    {
      if ( ! isset ( $info[$interval] ) )
      {
        $info[$interval]['time'] = time ( );
        $info[$interval]['count'] = 0;
      }

      $info[$interval]['count'] += 1;

      if ( time ( ) - $info[$interval]['time'] &gt; $interval )
      {
        $info[$interval]['count'] = 1;
        $info[$interval]['time'] = time ( );
      }

      if ( $info[$interval]['count'] &gt; $limit )
      {
        $info[$interval]['time'] = time ( );
        $no_flood = FALSE;
      }

      // The following two lines can be used for debugging
      // echo $info[$interval]['count'].'  ';
      // echo $info[$interval]['time'].'&lt;br&gt;';

    }  // foreach

    return $no_flood;

  }
  /*
    Description:
      Checks flooding. Must be called after setting up all necessary properties.
    Prototype:
      bool CheckFlood ( )
    Return:
      FALSE if flood detected, otherwise - TRUE.
  */
  function CheckFlood ( )
  {

    $this-&gt;CheckCron ( );

    $path = $this-&gt;logs_path . $this-&gt;ip_addr;

    if ( ! ( $f = fopen ( $path, 'a+' ) ) )
      trigger_error ( E_LOG_FILE, E_USER_ERROR);

    flock ( $f, LOCK_EX );

    $info = fread ( $f, filesize ( $path ) + 10 );
    $info = unserialize( $info );

    $result = $this-&gt;RawCheck ( $info );

    ftruncate ( $f, 0 );
    fwrite ( $f, serialize( $info ) );
    fflush ( $f );

    flock($f, LOCK_UN);

    fclose($f);

    return $result;

  }
  /*
    Description:
      Checks the cron file and calls CronJob() to delete old entries from logs
      directory if the time-out is reached.
    Prototype:
      void CheckCron ( )
  */
  function CheckCron ( )
  {

    if ( substr ( $this-&gt;cron_file, 0, 1 ) != '.' )
    {
      trigger_error ( E_CRON_FNAME, E_USER_WARNING );
      return;
    }

    $path = $this-&gt;logs_path . $this-&gt;cron_file;

    if ( ! ( $f = fopen ( $path, 'a+' ) ) )
    {
      trigger_error ( E_CRON_FILE, E_USER_WARNING );
      return;
    }

    flock ( $f, LOCK_EX );

    $last_cron = fread ( $f, filesize ( $path ) + 10 );
    $last_cron = abs ( intval ( $last_cron ) );

    if ( time ( ) - $last_cron &gt; $this-&gt;cron_interval )
    {
      $this-&gt;CronJob ( );
      $last_cron = time ( );
    }

    ftruncate ( $f, 0 );
    fwrite ( $f, $last_cron );
    fflush ( $f );

    flock ( $f, LOCK_UN );

    fclose ( $f );

  }
  /*
    Description:
      Deletes all old files from logs directory, except the files starting
      with dot.
    Prototype:
      void CronJob ( )
  */
  function CronJob ( )
  {

    $path = $this-&gt;logs_path;

    if ( ! ( $dir_hndl = opendir ( $this-&gt;logs_path ) ) )
    {
      trigger_error ( E_CRON_JOB, E_USER_WARNING);
      return;
    }

    while ( $fname = readdir ( $dir_hndl ) )
    {
      if ( substr( $fname, 0, 1 ) == '.' )
        continue;
      clearstatcache ( );
      $ftm = filemtime ( $path . $fname );
      if ( time ( ) - $ftm &gt; $this-&gt;logs_timeout )
        @unlink ( $path . $fname );
    }

    closedir ( $dir_hndl );

  }

}  // end of class definition

 

/*
  $flb = new FloodBlocker ( 'example/tmp-ips/' );
  $flb-&gt;rules = array ( 10=&gt;5 );
  $res = $flb-&gt;CheckFlood ( );
  if ( $res )
    echo 'Succeed!';
  else
    die ( 'Too many requests! Please try later.' );
*/

?&gt;</pre>
<p>Kullanım Şekli</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php

  // Place flood protection code at the top of the script you want to protect.
  // You can write protection code into separate file and include it in every
  // page of your site.

  // Sample protection code starts here...

  // Include the class definition module.

  require_once ( '../class.floodblocker.php' );

  // In the following line write the full path to temporary directory in which
  // you want to store flood counters. It is good idea to create such folder
  // somewhere outside your documents directory, to make it unaccessable from Web.
  // Don't forget that the directory must have permissions to write files in it.
  // IMPORTANT!
  // All files in this folder (except those that start with dot, e.g.'.htaccess')
  // will be deleted by FloodBlocker, so don't keep anything there.

  $flb = new FloodBlocker ( 'tmp-ips/' );

  // Create as many rules as you want...

  $flb-&gt;rules = array (
    10=&gt;10,    // rule 1 - maximum 10 requests in 10 secs
    60=&gt;30,    // rule 2 - maximum 30 requests in 60 secs
    300=&gt;50,   // rule 3 - maximum 50 requests in 300 secs
    3600=&gt;200  // rule 4 - maximum 200 requests in 3600 secs
  );

  // At last call CheckFlood(), it will return FALSE if flood detected on any
  // of specified rules.

  if ( ! $flb-&gt;CheckFlood ( ) )
    die ( 'Too many requests! Please try later.' );

  // ... that's all. Enjoy!

?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;The title of my page...&lt;/title&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#cccccc&quot;&gt;
&lt;h1&gt;Welcome to my page...&lt;/h1&gt;
No flood was detected if you see the contents of this page...
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fphp_ile_saldirilari_onlemek%2F&amp;title=Php%20ile%20sald%C4%B1r%C4%B1lar%C4%B1%20%C3%B6nlemek" id="wpa2a_6">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php_ile_saldirilari_onlemek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP ile güzel grafikler</title>
		<link>http://blog.kesdi.com/php/php-ile-guzel-grafikler/</link>
		<comments>http://blog.kesdi.com/php/php-ile-guzel-grafikler/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 09:30:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[chart]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=348</guid>
		<description><![CDATA[PHP/SWF Charts, PHP kullanarak dinamik veri kaynağından basitçe, güçlü ve etkileyici grafikler sunmak için bir araç. Grafiği sunarken kullanılabilecek birçok flash tasarımı var. Örneğin aşağıdaki grafiği oluşturmak için şöyle bir kod kullanmak yetiyor;]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.kesdi.com/php/php-ile-guzel-grafikler/attachment/phpflashchart/" rel="attachment wp-att-349"><img src="http://blog.kesdi.com/dosyalar/2009/06/phpflashchart.jpg" alt="phpflashchart" title="phpflashchart" width="400" height="251" class="alignleft size-full wp-image-349" /></a><a href="http://www.maani.us/charts/index.php?menu=Gallery">PHP/SWF Charts</a>, PHP kullanarak dinamik veri kaynağından basitçe, güçlü ve etkileyici grafikler sunmak için bir araç. Grafiği sunarken kullanılabilecek birçok flash tasarımı var. Örneğin aşağıdaki grafiği oluşturmak için şöyle bir kod kullanmak yetiyor;</p>
<pre class="brush: plain; title: ; notranslate">&amp;lt;?php
include “charts.php”;

//the chart’s data
$chart [ 'chart_data' ] = array ( array ( “”,         “2001″, “2002″, “2003″, “2004″ ),
array ( “Region A”,     5,     10,     30,     63  ),
array ( “Region B”,   100,     20,     65,     55  ),
array ( “Region C”,    56,     21,      5,     90  )
);

//send the new data to charts.swf
SendChartData ( $chart );

?&amp;gt;
 </pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fphp-ile-guzel-grafikler%2F&amp;title=PHP%20ile%20g%C3%BCzel%20grafikler" id="wpa2a_8">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ile-guzel-grafikler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP kullanarak büyük dosya gönderme</title>
		<link>http://blog.kesdi.com/php/php-kullanarak-buyuk-dosya-gonderme/</link>
		<comments>http://blog.kesdi.com/php/php-kullanarak-buyuk-dosya-gonderme/#comments</comments>
		<pubDate>Sun, 17 May 2009 13:44:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=249</guid>
		<description><![CDATA[Web sunucularının çoğu sadece 2MB büyüklüğünde dosya yüklemeye izin verir. Bu nedenle daha büyük dosyaları kullanmak sorun olmaktadır. Bu yazıda daha büyük dosya yükleyebilmek için .htaccess ile yapılması gereken ayarları anlatacağım. 1) web sunucunuzun kök klasöründe bir .htaccess dosyası oluşturun. 2) .htaccess dosyası içine aşağıdaki kodu yazın ve kaydedin. Artık 20Megabyte a kadar olan dosyaları [...]]]></description>
			<content:encoded><![CDATA[<p>Web sunucularının çoğu sadece 2MB büyüklüğünde dosya yüklemeye izin verir. Bu nedenle daha büyük dosyaları kullanmak sorun olmaktadır. Bu yazıda daha büyük dosya yükleyebilmek için .htaccess ile yapılması gereken ayarları anlatacağım.<br />
1) web sunucunuzun kök klasöründe bir .htaccess dosyası oluşturun.</p>
<p>2) .htaccess dosyası içine aşağıdaki kodu yazın ve kaydedin.</p>
<pre class="brush: plain; title: ; notranslate">
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
</pre>
<p>Artık 20Megabyte a kadar olan dosyaları move_uploaded_file() fonksiyonu ve HTML form yardımı ile gönderebilirsiniz.</p>
<p>Eğer 20MB üzeri dosya göndermek istiyorsanız, parametreleri isteğinize göre değiştirebilirsiniz.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fphp-kullanarak-buyuk-dosya-gonderme%2F&amp;title=PHP%20kullanarak%20b%C3%BCy%C3%BCk%20dosya%20g%C3%B6nderme" id="wpa2a_10">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-kullanarak-buyuk-dosya-gonderme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gerçek IP adresini almak</title>
		<link>http://blog.kesdi.com/php/gercek-ip-adresini-almak/</link>
		<comments>http://blog.kesdi.com/php/gercek-ip-adresini-almak/#comments</comments>
		<pubDate>Sun, 17 May 2009 11:46:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=243</guid>
		<description><![CDATA[Php ile gerçek IP adresini almaya yarayan fonksiyon. Umarım işinize yarar.]]></description>
			<content:encoded><![CDATA[<p>Php ile gerçek IP adresini almaya yarayan fonksiyon. Umarım işinize yarar.</p>
<pre class="brush: php; title: ; notranslate">
function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //Paylaşılmız internet IPsini kontrol et
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //proxy IPsini kontrol et
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}  </pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fgercek-ip-adresini-almak%2F&amp;title=Ger%C3%A7ek%20IP%20adresini%20almak" id="wpa2a_12">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/gercek-ip-adresini-almak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php ile veritabanı yedeğini almak</title>
		<link>http://blog.kesdi.com/linux/php-ile-veritabani-yedegini-almak/</link>
		<comments>http://blog.kesdi.com/linux/php-ile-veritabani-yedegini-almak/#comments</comments>
		<pubDate>Sun, 10 May 2009 08:42:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webmaster]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=219</guid>
		<description><![CDATA[Php ile veri tabanı yedeğinizi alabilirsiniz. Hatta bu işi cronjob ile otomatikleştirebilirsiniz. İşte gerekli olan php kodu.]]></description>
			<content:encoded><![CDATA[<p>Php ile veri tabanı yedeğinizi alabilirsiniz. Hatta bu işi cronjob ile otomatikleştirebilirsiniz. İşte gerekli olan php kodu.</p>
<p><span id="more-219"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/**
*
* Veri Tabanı Yedekleme
*
**/

// scriptiniz uzun süre çalışıyorsa bu fonksiyonu kullanın
// ve cron a eklerken log tutmayı devre dışı bırakın
ignore_user_abort();

// konfigurasyon
$host = ‘localhost’;                 //hostunuza göre düzeltin
$username = ‘username’;              //veritabanı kullanıcı isminiz
$password = ‘password’;              //veritabanı şifreniz
$database = ‘database_name’;         //veritabanı isminiz
$path = ‘/home/myuser/backups/’;     //yedek alinacak dizin

$filename = $database.‘_’.date(‘Y-m-d_H:i:s’).‘.gz’;
$backup = $path.$filename;

$backup_command = “mysqldump –opt -h $host -u $username -p$password $database | gzip &gt; $backup”;

if(exec($backup_command)==” &amp;&amp; file_exists($backup))
{
   echo “Yedek başarı ile alındı”;
}
else
{
   echo “Yedek alınırken hata oluştu”;
}
?&gt; </pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Flinux%2Fphp-ile-veritabani-yedegini-almak%2F&amp;title=php%20ile%20veritaban%C4%B1%20yede%C4%9Fini%20almak" id="wpa2a_14">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/linux/php-ile-veritabani-yedegini-almak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer Frame Iframe Sesion Hatası</title>
		<link>http://blog.kesdi.com/php/internet-explorer-frame-iframe-sesion-hatasi/</link>
		<comments>http://blog.kesdi.com/php/internet-explorer-frame-iframe-sesion-hatasi/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 13:09:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Explorer Session Bug]]></category>
		<category><![CDATA[Php Bug]]></category>
		<category><![CDATA[Php Session Bug]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=141</guid>
		<description><![CDATA[Internet Explorer&#8217;da, php session bilgileri frame ve iframe içinde hata verebiliyor.  Yani, session bilginiz, frame veya iframe içinde çalışmıyor. Bu sorunu çözmek için php içinden bir header bilgisi göndermek yetrli oluyor. Bütün explorer bugları da beni mi buluyor epey başımı ağrıtmıştı bu bug benim başıma geldiğinde. Neyseki çözdük. header(’P3P: CP=”NOI ADM DEV PSAi COM NAV [...]]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer&#8217;da, php session bilgileri frame ve iframe içinde hata verebiliyor.  Yani, session bilginiz, frame veya iframe içinde çalışmıyor. Bu sorunu çözmek için php içinden bir header bilgisi göndermek yetrli oluyor. Bütün explorer bugları da beni mi buluyor <img src='http://blog.kesdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  epey başımı ağrıtmıştı bu bug benim başıma geldiğinde. Neyseki çözdük.</p>
<p><span id="more-141"></span></p>
<p>header(’P3P: CP=”NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM”‘);</p>
<p>inşallah işinize yarar.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Finternet-explorer-frame-iframe-sesion-hatasi%2F&amp;title=Internet%20Explorer%20Frame%20Iframe%20Sesion%20Hatas%C4%B1" id="wpa2a_16">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/internet-explorer-frame-iframe-sesion-hatasi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Popup pencerede php session problemi</title>
		<link>http://blog.kesdi.com/php/popup-pencerede-php-session-problemi/</link>
		<comments>http://blog.kesdi.com/php/popup-pencerede-php-session-problemi/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 13:00:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Explorer Session Bug]]></category>
		<category><![CDATA[Php Bug]]></category>
		<category><![CDATA[Php Session Bug]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=137</guid>
		<description><![CDATA[Sadece Internet Explorer&#8217;da sorun çıkaran Firefox içinde sıkıntı çıkarmayan, genelde php kurulumu ile ilgili olan bu sorun, sunucuya erişiminiz yoksa pratik olarak, session ID sini adres satırından göndererek çözülebiliyor. En azından ben bu şekilde çözebildim. Aşağıda adres satırından session ID yi nasıl gönderdiğim ile ilgili kodları yazdım. &#60;? PHP $thisSession = Session_Name().&#8217;=&#8217;.Session_ID(); ?&#62; popup pencereyi [...]]]></description>
			<content:encoded><![CDATA[<p>Sadece Internet Explorer&#8217;da sorun çıkaran Firefox içinde sıkıntı çıkarmayan, genelde php kurulumu ile ilgili olan bu sorun, sunucuya erişiminiz yoksa pratik olarak, session ID sini adres satırından göndererek çözülebiliyor. En azından ben bu şekilde çözebildim.</p>
<p>Aşağıda adres satırından session ID yi nasıl gönderdiğim ile ilgili kodları yazdım.<span id="more-137"></span></p>
<p>&lt;? PHP $thisSession = Session_Name().&#8217;=&#8217;.Session_ID(); ?&gt;</p>
<p>popup pencereyi açarken çağıcağınız adres sonunda, adres.com/sayfa.php?&lt;?PHP echo $thisSession;?&gt;  şeklinde session bilgisini göndermeniz gerekiyor.</p>
<p>Eğer sunucuya erişiminiz varsa php.ini dosyasinda register_long_arrays değerini açarak da çözebilirsiniz.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fpopup-pencerede-php-session-problemi%2F&amp;title=Popup%20pencerede%20php%20session%20problemi" id="wpa2a_18">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/popup-pencerede-php-session-problemi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>İşe yarayabilecek php kodları</title>
		<link>http://blog.kesdi.com/php/ise-yarayabilecek-php-kodlari/</link>
		<comments>http://blog.kesdi.com/php/ise-yarayabilecek-php-kodlari/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 21:15:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Kodları]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=80</guid>
		<description><![CDATA[PHP ve diğer programlama çalışmalarında kolaylık sağlayacak ve rutin işlemleri kolaylaştıracak olan, derleyip seçtiğim bu bir kaç yararlı fonksiyon, sınıf (class) ve javascript dizisini sizlerle paylaşmak istiyorum. İki aralığın arasındaki değerleri dizi olarak bir değişkene yüklemeye yarayan bir fonksiyon; function al( $bas, $son, $yazi ) { @preg_match_all('/' . preg_quote($bas, '/') . '(.*?)'. preg_quote($son, '/').'/i', $yazi, [...]]]></description>
			<content:encoded><![CDATA[<p>PHP ve diğer programlama çalışmalarında kolaylık sağlayacak ve rutin işlemleri kolaylaştıracak olan, derleyip seçtiğim bu bir kaç yararlı fonksiyon, sınıf (class) ve javascript dizisini sizlerle paylaşmak istiyorum. <span id="more-80"></span></p>
<p><small><strong><span style="font-size: x-small;">İki aralığın arasındaki değerleri dizi olarak bir değişkene yüklemeye yarayan bir fonksiyon;</span></strong></small></p>
<pre>function al( $bas, $son, $yazi )
{
	@preg_match_all('/' . preg_quote($bas, '/') .
	'(.*?)'. preg_quote($son, '/').'/i', $yazi, $m);
	return @$m[1];
}</pre>
<p>Diğer işe yarar kodları incelemeyi unutmayın;<br />
<small><strong><span style="font-size: x-small;">Perma link yapımlarında türkçe karakterleri düzeltip seo uyumlu linkler yapmaya yarayan bir fonksiyon;</span></strong></small></p>
<pre>function perma( $baslik )
{
	$bul = array('Ç', 'Ş', 'Ğ', 'Ü', 'İ', 'Ö', 'ç', 'ş', 'ğ', 'ü', 'ö', 'ı');
	$yap = array('c', 's', 'g', 'u', 'i', 'o', 'c', 's', 'g', 'u', 'o', 'i');
	$perma = trim(strtolower(str_replace($bul, $yap, $baslik)));
	$perma = preg_replace("@[^A-Za-z0-9\-_]@i", '', $perma);
	$perma = str_replace(' ', '-', $perma);
	return $perma;
}</pre>
<p><small><strong><span style="font-size: x-small;">Klasik derlenmiş bir curl fonksiyonu;</span></strong></small></p>
<pre>function ch( $url, $post=false, $header=false )
{
    $user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6';
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, $header ? true : false);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, $post ? true : false);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post ? $post : false);
	curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt($ch, CURLOPT_REFERER, $URL);
	$icerik = curl_exec($ch);
	curl_close($ch);
	return $icerik;
}</pre>
<p><small><strong><a href="http://ajax-tr.com/eyceks-kutuphanesi-ve-ornek-bir-uygulama/"><span style="font-size: x-small;">Eyceks</span></a><span style="font-size: x-small;"> kütüphanesinden temiz bir derleme ile javascript ajax fonksiyonu;</span></strong></small></p>
<pre>function nesne()
{
	var nesne;
	var tarayici = navigator.appName;

	if(tarayici == "Microsoft Internet Explorer")
	{
		nesne = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		nesne = new XMLHttpRequest();
	}
	return nesne;
}
	var http = nesne();

function ajax(sayfa,deger,yer)
{
	http.open('get', sayfa + '?' + deger);
	http.onreadystatechange = cevap;
	http.send(null);

	function cevap()
	{
		if(http.readyState == 4)
		{
			document.getElementById(yer).innerHTML = http.responseText;
		} else {
			if(http.readyState == 1)
			{
				document.getElementById(yer).innerHTML = "Bekleyin";
			}
		}
	}
}</pre>
<p><span style="font-size: x-small;"><small><strong>PHP çalışmalarınızda rahat ve hızlı bir mysql yönetimi sağlayan, önceden hazırladığım ve hazırladığım günden beri her çalışmamda kullandığım, PHP için MYSQL sınıfı;</strong></small><br />
</span>Sınıfı tanıttığım yazıma ulaşmak için <a href="http://www.teyt.org/php-icin-mysql-sinifi">buradan</a> buyurun.</p>
<p><small><strong><span style="font-size: x-small;">Sitelerinizde aşırı ziyaretçi nedeniyle yaşanan aşırı işlem yoğunluğunu azaltmak ve sistemi rahatlatmak amacıyla hazırladığım bir PHP sayfa çıktısını önbellekleme fonksiyonu;</span></strong></small></p>
<pre>/*
	Php Onbellekleme Sistemi (cache)
	Strefrextor
	14.7.8
*/

$root = $_SERVER['DOCUMENT_ROOT'];
$temp = $root.'bellek/'; # Onbelleklerin tutulacagi dizin
$zaman = 1; # Onbellekleme suresi (Saat)

function bellek_ust(){
	global $zaman, $temp;

	$gonderiler = !empty($_SERVER[QUERY_STRING]) ? '-' . md5($_SERVER[QUERY_STRING]) : null;
	$sayfa = substr($_SERVER[SCRIPT_NAME],1) . $gonderiler . '.html';
	$dosya = $temp . $sayfa;

	if(file_exists($dosya)):
		$dzaman = filemtime($dosya);
		$czaman = time() - ($zaman * 60 * 60);
		if($czaman &lt; $dzaman):
			echo file_get_contents($dosya);
			exit;
		else:
			unlink($dosya);
		endif;
		ob_start();
	endif;
}

function bellek_alt(){
	global $temp;

	$gonderiler = !empty($_SERVER[QUERY_STRING]) ? '-' . md5($_SERVER[QUERY_STRING]) : null;
	$sayfa = substr($_SERVER[SCRIPT_NAME],1) . $gonderiler . '.html';
	$dosya = $temp . $sayfa;

	$icerik = ob_get_contents();
	$ac = fopen($dosya,'w+');
	fwrite($ac,$icerik);
	fclose($ac);
	ob_end_flush();
}</pre>
<p><small><span style="font-size: x-small;">( Bu fonksiyonun kullanımı: Belleklenecek olan sayfaların başında ilk olarak bu fonksiyonları tanımlamanız, daha sonra üst kısmına “bellek_ust()” sonuna ise “bellek_alt()” fonksiyonlarını çağırmanız yeterli olur. )</span></small></p>
<p><small><strong><span style="font-size: x-small;">Dışardan direk olarak bir sorguya yönlendirdiğiniz değerleri mutlaka önceden bu fonksiyon ile HTML taglarının ve çift, tek tırnakların etkisiz hale getirilmesini sağlayın, aksi taktirde hem üyelik hesapları olarak hemde içerik saldırıları olarak çok büyük tehditler altında kalabilirsiniz. <span class="d">SQL enjeksiyon</span> gibi basit ama <span class="d">çok tehlikeli</span> bazı açıkların önüne geçmek için basit bir fonksiyon;</span></strong></small></p>
<pre>function duzelt( $deger )
{
	return htmlspecialchars(addslashes( $deger ));
}</pre>
<p><small><strong><span style="font-size: x-small;">SEO uyumlu sitelerinizde en iyi başlıklı URL ler için kullanabileceğiz, WordPress’in htaccess dosyası;</span></strong></small></p>
<pre>RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</pre>
<p>Sizlerinde kullandığı bu tipte işe yarar fonksiyon veya faydalı kütüphaneler varsa eğer bizlerle paylaşmayı esirgemeyin ve başka bir sanal serüvende görüşmek üzere hoşçakalın.</p>
<p>Kaynak: <a href="http://www.teyt.org/php-calismalariniz-icin-ise-yarar-kodlar/">http://www.teyt.org/php-calismalariniz-icin-ise-yarar-kodlar/</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.kesdi.com%2Fphp%2Fise-yarayabilecek-php-kodlari%2F&amp;title=%C4%B0%C5%9Fe%20yarayabilecek%20php%20kodlar%C4%B1" id="wpa2a_20">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/ise-yarayabilecek-php-kodlari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

