<?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/konular/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>PHP öntanımlı değişkenler</title>
		<link>http://blog.kesdi.com/php/php-ontanimli-degiskenler/</link>
		<comments>http://blog.kesdi.com/php/php-ontanimli-degiskenler/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 08:07:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=667</guid>
		<description><![CDATA[Bazen aklımdan çıkıyor hangi ön tanımlı değişkenler vardı diye.  Şöyle derli toplu açıklamalı bir liste burada dursa fena olmaz. PHP Superglobals: Variable Description $GLOBALS Contains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables. $_SERVER This [...]]]></description>
			<content:encoded><![CDATA[<p>Bazen aklımdan çıkıyor hangi ön tanımlı değişkenler vardı diye.  Şöyle derli toplu açıklamalı bir liste burada dursa fena olmaz.<br />
<span id="more-667"></span></p>
<h2>PHP Superglobals:</h2>
<table style="width: 100%;" border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<th width="10%">Variable</th>
<th width="90%">Description</th>
</tr>
<tr>
<td>$GLOBALS</td>
<td>Contains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables.</td>
</tr>
<tr>
<td>$_SERVER</td>
<td>This is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER variables.</td>
</tr>
<tr>
<td>$_GET</td>
<td>An associative array of variables passed to the current script via the HTTP GET method.</td>
</tr>
<tr>
<td>$_POST</td>
<td>An associative array of variables passed to the current script via the HTTP POST method.</td>
</tr>
<tr>
<td>$_FILES</td>
<td>An associative array of items uploaded to the current script via the HTTP POST method.</td>
</tr>
<tr>
<td>$_REQUEST</td>
<td>An associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.</td>
</tr>
<tr>
<td>$_COOKIE</td>
<td>An associative array of variables passed to the current script via HTTP cookies.</td>
</tr>
<tr>
<td>$_SESSION</td>
<td>An associative array containing session variables available to the current script.</td>
</tr>
<tr>
<td>$_PHP_SELF</td>
<td>A string containing PHP script file name in which it is called.</td>
</tr>
<tr>
<td>$php_errormsg</td>
<td>$php_errormsg is a variable containing the text of the last error message generated by PHP.</td>
</tr>
</tbody>
</table>
<h2>Server variables: $_SERVER</h2>
<p>$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these.</p>
<table style="width: 100%;" border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<th width="10%">Variable</th>
<th width="90%">Description</th>
</tr>
<tr>
<td>$_SERVER['PHP_SELF']</td>
<td>The filename of the currently executing script, relative to the document root</td>
</tr>
<tr>
<td>$_SERVER['argv']</td>
<td>Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.</td>
</tr>
<tr>
<td>$_SERVER['argc']</td>
<td>Contains the number of command line parameters passed to the script if run on the command line.</td>
</tr>
<tr>
<td>$_SERVER['GATEWAY_INTERFACE']</td>
<td>What revision of the CGI specification the server is using; i.e. &#8216;CGI/1.1&#8242;.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_ADDR']</td>
<td>The IP address of the server under which the current script is executing.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_NAME']</td>
<td>The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_SOFTWARE']</td>
<td>Server identification string, given in the headers when responding to requests.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_PROTOCOL']</td>
<td>Name and revision of the information protocol via which the page was requested; i.e. &#8216;HTTP/1.0&#8242;;</td>
</tr>
<tr>
<td>$_SERVER['REQUEST_METHOD']</td>
<td>Which request method was used to access the page; i.e. &#8216;GET&#8217;, &#8216;HEAD&#8217;, &#8216;POST&#8217;, &#8216;PUT&#8217;.</td>
</tr>
<tr>
<td>$_SERVER['REQUEST_TIME']</td>
<td>The timestamp of the start of the request. Available since PHP 5.1.0.</td>
</tr>
<tr>
<td>$_SERVER['QUERY_STRING']</td>
<td>The query string, if any, via which the page was accessed.</td>
</tr>
<tr>
<td>$_SERVER['DOCUMENT_ROOT']</td>
<td>The document root directory under which the current script is executing, as defined in the server&#8217;s configuration file.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_ACCEPT']</td>
<td>Contents of the Accept: header from the current request, if there is one.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_ACCEPT_CHARSET']</td>
<td>Contents of the Accept-Charset: header from the current request, if there is one. Example: &#8216;iso-8859-1,*,utf-8&#8242;.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_ACCEPT_ENCODING']</td>
<td>Contents of the Accept-Encoding: header from the current request, if there is one. Example: &#8216;gzip&#8217;.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_ACCEPT_LANGUAGE']</td>
<td>Contents of the Accept-Language: header from the current request, if there is one. Example: &#8216;en&#8217;.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_CONNECTION']</td>
<td>Contents of the Connection: header from the current request, if there is one. Example: &#8216;Keep-Alive&#8217;.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_HOST']</td>
<td>Contents of the Host: header from the current request, if there is one.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_REFERER']</td>
<td>The address of the page (if any) which referred the user agent to the current page.</td>
</tr>
<tr>
<td>$_SERVER['HTTP_USER_AGENT']</td>
<td>This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586).</td>
</tr>
<tr>
<td>$_SERVER['HTTPS']</td>
<td>Set to a non-empty value if the script was queried through the HTTPS protocol.</td>
</tr>
<tr>
<td>$_SERVER['REMOTE_ADDR']</td>
<td>The IP address from which the user is viewing the current page.</td>
</tr>
<tr>
<td>$_SERVER['REMOTE_HOST']</td>
<td>The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.</td>
</tr>
<tr>
<td>$_SERVER['REMOTE_PORT']</td>
<td>The port being used on the user&#8217;s machine to communicate with the web server.</td>
</tr>
<tr>
<td>$_SERVER['SCRIPT_FILENAME']</td>
<td>The absolute pathname of the currently executing script.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_ADMIN']</td>
<td>The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_PORT']</td>
<td>The port on the server machine being used by the web server for communication. For default setups, this will be &#8217;80&#8242;.</td>
</tr>
<tr>
<td>$_SERVER['SERVER_SIGNATURE']</td>
<td>String containing the server version and virtual host name which are added to server-generated pages, if enabled.</td>
</tr>
<tr>
<td>$_SERVER['PATH_TRANSLATED']</td>
<td>Filesystem based path to the current script.</td>
</tr>
<tr>
<td>$_SERVER['SCRIPT_NAME']</td>
<td>Contains the current script&#8217;s path. This is useful for pages which need to point to themselves.</td>
</tr>
<tr>
<td>$_SERVER['REQUEST_URI']</td>
<td>The URI which was given in order to access this page; for instance, &#8216;/index.html&#8217;.</td>
</tr>
<tr>
<td>$_SERVER['PHP_AUTH_DIGEST']</td>
<td>When running under Apache as module doing Digest HTTP authentication this variable is set to the &#8216;Authorization&#8217; header sent by the client.</td>
</tr>
<tr>
<td>$_SERVER['PHP_AUTH_USER']</td>
<td>When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user.</td>
</tr>
<tr>
<td>$_SERVER['PHP_AUTH_PW']</td>
<td>When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user.</td>
</tr>
<tr>
<td>$_SERVER['AUTH_TYPE']</td>
<td>When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.</td>
</tr>
</tbody>
</table>
<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-ontanimli-degiskenler%2F&amp;title=PHP%20%C3%B6ntan%C4%B1ml%C4%B1%20de%C4%9Fi%C5%9Fkenler" id="wpa2a_2">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ontanimli-degiskenler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Session işlemlerini Kolaylaştıran Class</title>
		<link>http://blog.kesdi.com/php/session-islemlerini-kolaylastiran-class/</link>
		<comments>http://blog.kesdi.com/php/session-islemlerini-kolaylastiran-class/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 08:04:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=663</guid>
		<description><![CDATA[Bu Class Mehmet Şamlı Tarafından Yazılmış bir Class’tır. Class’ın amacı Kod’lar içerisinde session işlemlerinin kolaylaştırılması . Kısaca Bahsedersek . Class Session’ları oluşturur,Siler,session_id sini verir, Dizi halinde session oluşturma imkanı vardır. Zaten kullanınca Öğreneceksiniz . Session’lar genelde dosya halindedir. Fakat bu class bilgileri Memory’de Saklamaktadır. Ayrıca bu class’da sabit olarak session adı ve session expire süresi [...]]]></description>
			<content:encoded><![CDATA[<p>Bu Class Mehmet Şamlı Tarafından Yazılmış bir Class’tır.</p>
<p>Class’ın amacı Kod’lar içerisinde session işlemlerinin kolaylaştırılması .</p>
<p>Kısaca Bahsedersek . Class Session’ları oluşturur,Siler,session_id sini verir, Dizi halinde session oluşturma imkanı vardır. Zaten kullanınca Öğreneceksiniz . Session’lar genelde dosya halindedir. Fakat bu class bilgileri Memory’de Saklamaktadır. Ayrıca bu class’da sabit olarak session adı ve session expire süresi ayarlarıda mevcuttur. Saniye Bazından ayarlanabilmektedir.</p>
<p><span id="more-663"></span></p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
/**
 * @author Umut
 * @copyright 2011
 * @version PHP 6.0.0
 */
 class session
 {
 /**
 * Session Zaman Aşımı Süresi
 */
 const TIMEOUT = '300';
 /**
 * Session Adı
 */
 const SESSION_NAME = 'JSESSIONID';
 public static function set()
 {
 //Session expire süresi belirliyoruz.
 ini_set('session.gc_maxlifetime',self::TIMEOUT);
 self::setSessionName();
 self::startsession();
 }
 private static function startsession()
 {
 session_start();
 }
 private static function setSessionName()
 {
 session_name(self::SESSION_NAME);
 }
 /**
 * Session atayan method. Dizideki parametreleri session olarak atar.
 * @param array $sessionArr
 */
 public static function createSession($sessionArr)
 {
 if ( is_array($sessionArr))
 {
 $count = count($sessionArr);
 if($count%2==0)
 {
 $i  = 0 ;
 while($i&lt;$count)
 {
 $_SESSION[$sessionArr[$i]] = $sessionArr[$i+1];
 $i+=2;
 }
 return true;
 }
 }
 return false ;
 }
 /**
 * session işlemlerini sonlandırmak için kullanılan method
 * tek tek session'ları array olarak göndererek silebildiği gibi $all paramatresi
 * true olarak göndererk tüm session'ları silebilir
 *  @param array $sessionArr array('fname','lname')
 *  $param boolean $all
 * return boolean
 */
 public static function deleteSession($sessionArr,$all=false)
 {
 if($all)
 {
 session_destroy();
 echo &quot;session'lar destroy edildi&quot;;
 return true ;
 }
 if(is_array($sessionArr))
 {
 $count = count($sessionArr);
 $i=0;
 while($i&lt;$count)
 {  unset($_SESSION[$sessionArr[$i]]);  $i++;  }
 foreach($sessionArr as $name)
 {  unset($_SESSION[$name]);

 }
 return true;
 }

 return false;
 }
 /**  * session bilgisini get eder  */
 public static function getSessionId($regenerate=false)
 {  if ($regenerate)
 {  session_regenerate_id();  }

 return session_id();
 }  /**  * Session Adını Get eder  */
 public static  function getSession($name)
 {

  return $_SESSION[$name];

 }
 public static function sessionVariable($sessionName)
 {  if(isset($_SESSION[$sessionName]))

 return true;

 else  return false;

 }

 } ?&gt;
</pre>
<p>kullanımı</p>
<pre class="brush: plain; title: ; notranslate">
session::set(); // Tüm Oturumları Başlatır.
$veri = array('Adi','UFUK','soyadi','bağci');
session::createSession($veri);// Session'ları oluşturur.
session::deleteSession(array('Adi','Soyadi')); // Verilen isimdeki Session'ları  yok eder.
session::deleteSession(array(),TRUE); // Hepsini YokEder.
echo session::getSessionId(TRUE); // Session Bilgisini Get Eder.
</pre>
<p>Yukarıdaki sınıfı henüz inceleme fırsatım olmadı, ama burada dursun diye sayfaya ekledim. İleride lazım olursa fikir verebilir.</p>
<p>Kaynak : http://www.jettem.tk/2011/php/php-session-islemlerini-kolaylastiran-class.html</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%2Fsession-islemlerini-kolaylastiran-class%2F&amp;title=Session%20i%C5%9Flemlerini%20Kolayla%C5%9Ft%C4%B1ran%20Class" id="wpa2a_4">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/session-islemlerini-kolaylastiran-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xampp yeni güvenlik konsepti (new security consept)</title>
		<link>http://blog.kesdi.com/php/xampp-yeni-guvenlik-konsepti-new-security-consept/</link>
		<comments>http://blog.kesdi.com/php/xampp-yeni-guvenlik-konsepti-new-security-consept/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 10:51:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webmaster]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=615</guid>
		<description><![CDATA[Xampp in yeni versiyonlarında, yerel ağ dışından erişmeye çalıştığınızda Eriim yasak! Yeni XAMPP güvenlik konsepti: Istenen dizine erişim yalnızca yerel ağ mevcuttur. Bu ayar dosyası &#8220;olarak yapılandırılmış olabilir olacak httpd-xampp.conf&#8221;. Bunun bir sunucu hatası olduğunu düşünüyorsanız, lütfen site yöneticisi ile iletişime geçin. Error 403 şeklinde bir hata mesajı veriyor.  Güvenlik için yeni versiyonlarında farklı bir [...]]]></description>
			<content:encoded><![CDATA[<p>Xampp in yeni versiyonlarında, yerel ağ dışından erişmeye çalıştığınızda</p>
<h1>Eriim yasak!</h1>
<hr />
<p>Yeni XAMPP güvenlik konsepti:</p>
<p>Istenen dizine erişim yalnızca yerel ağ mevcuttur.</p>
<p>Bu ayar dosyası &#8220;olarak yapılandırılmış olabilir olacak httpd-xampp.conf&#8221;.</p>
<hr />
<p>Bunun bir sunucu hatası olduğunu düşünüyorsanız, lütfen site yöneticisi ile iletişime geçin.</p>
<h2>Error 403</h2>
<p>şeklinde bir hata mesajı veriyor.  Güvenlik için yeni versiyonlarında farklı bir uygulamaya gitmiş anlaşılan apache friends. eğer yerel ağ dışında da web sayfasını kullanmak istiyorsanız aşağıdaki gibi düzeltme yapmanız gerekiyor.</p>
<p><span id="more-615"></span></p>
<p>1.  C:\xampp\apache\conf\extra\httpd-xampp.conf dosyasını açın.</p>
<p>2. aşağıdaki alanı bulun</p>
<p><em><strong>&lt;LocationMatch &#8220;^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))&#8221;&gt;</strong></em><br />
<em><strong> Order deny,allow</strong></em><br />
<em><strong> Deny from all</strong></em><br />
<em><strong> Allow from 127.0.0.0/8 </strong></em><br />
<em><strong> ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var</strong></em><br />
<em><strong>&lt;/LocationMatch&gt;</strong></em></p>
<p>3. Deny from all satırının önüne # işareti koyun</p>
<p>yani şu şekilde</p>
<p><em><strong>&lt;LocationMatch &#8220;^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))&#8221;&gt;</strong></em><br />
<em><strong> Order deny,allow</strong></em><br />
<em><strong> #Deny from all</strong></em><br />
<em><strong> Allow from 127.0.0.0/8 </strong></em><br />
<em><strong> ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var</strong></em><br />
<em><strong>&lt;/LocationMatch&gt;</strong></em></p>
<p>4. Dosyayı kaydedin, apache servisini yeniden başlatın.</p>
<p>Bitti <img src='http://blog.kesdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 270px; width: 1px; height: 1px; overflow: hidden;">
<h1>Eriim yasak!</h1>
<hr />
<p style="margin-left: 2.6em; font-size: 1.2em; color: red;">Yeni XAMPP güvenlik konsepti:</p>
<p>Istenen dizine erişim yalnızca yerel ağ mevcuttur.</p>
<p>Bu ayar dosyası &#8220;olarak yapılandırılmış olabilir olacak httpd-xampp.conf&#8221;.</p>
<hr />
<p>Bunun bir sunucu hatası olduğunu düşünüyorsanız, lütfen <a href="mailto:postmaster@localhost">site yöneticisi</a> ile iletişime geçin.</p>
<h2>Error 403</h2>
</div>
<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%2Fxampp-yeni-guvenlik-konsepti-new-security-consept%2F&amp;title=xampp%20yeni%20g%C3%BCvenlik%20konsepti%20%28new%20security%20consept%29" id="wpa2a_6">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/xampp-yeni-guvenlik-konsepti-new-security-consept/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP ile Random Hexadecimal Sayı Üretmek</title>
		<link>http://blog.kesdi.com/php/php-ile-random-hexadecimal-sayi-uretmek/</link>
		<comments>http://blog.kesdi.com/php/php-ile-random-hexadecimal-sayi-uretmek/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 08:34:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webmaster]]></category>
		<category><![CDATA[hegzadecimal]]></category>
		<category><![CDATA[hexadecimal]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[random hexadecimal]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=566</guid>
		<description><![CDATA[Php ile random hexadecimal sayı üretmek ile ilgili esnek bir fonksiyon bulamamıştım. 6 basamak seçerseniz random renk üretmek için kullanabilirsiniz. İhtiyacınıza göre basamak sayısını değiştirebilirsiniz.  Fonksiyonu bilinçli kullanacağınızı varsayarak minimum ve maksimum basamak sayılarını kontrol ettirmedim. minimum 10 maksimum 5  şeklinde değer girerseniz sıkıntı çıkarabilir. Umarım işinize yarar.  ]]></description>
			<content:encoded><![CDATA[<p>Php ile random hexadecimal sayı üretmek ile ilgili esnek bir fonksiyon bulamamıştım. 6 basamak seçerseniz random renk üretmek için kullanabilirsiniz. İhtiyacınıza göre basamak sayısını değiştirebilirsiniz. </p>
<p>Fonksiyonu bilinçli kullanacağınızı varsayarak minimum ve maksimum basamak sayılarını kontrol ettirmedim. <img src='http://blog.kesdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  minimum 10 maksimum 5  şeklinde değer girerseniz sıkıntı çıkarabilir. Umarım işinize yarar.</p>
<p> </p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
function randhex($minbasamak,$maxbasamak)
{
$a=0;
$b=0;
$hexmin=&quot;&quot;;
while ($a&lt;$minbasamak)
{
$hexmin=$hexmin.&quot;0&quot;;
$a++;
}

while ($b&lt;$maxbasamak)
{
$hexmax=$hexmax.&quot;F&quot;;
$b++;
}

$min = hexdec($hexmin); // minimum hegzadec değeri 10 luk sisteme çevriliyor
$max = hexdec($hexmax); // maximum hegzadec değeri 10 luk sisteme çevriliyor
$random = mt_rand($min, $max); // random değer üretiliyor
$random_hex = dechex($random); // üretilen değer hexadecimal e çevriliyor.
if (strlen($random_hex) &gt; $maxbasamak OR strlen($random_hex) &lt; $minbasamak) // basamak farklı ise tekrarlanıyor
    randhex($minbasamak,$maxbasamak);        // burada tekrar ediyor
else
    return $random_hex; // basamak kadar ise return ile değer döndürüyoruz.
}
echo randhex(2,4);
?&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-random-hexadecimal-sayi-uretmek%2F&amp;title=PHP%20ile%20Random%20Hexadecimal%20Say%C4%B1%20%C3%9Cretmek" id="wpa2a_8">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ile-random-hexadecimal-sayi-uretmek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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_10">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>jquery ile ajax kullanırken explorer 7&#8242;de refresh sorunu</title>
		<link>http://blog.kesdi.com/php/jquery-ile-ajax-kullanirken-explorer-7de-refresh-sorunu/</link>
		<comments>http://blog.kesdi.com/php/jquery-ile-ajax-kullanirken-explorer-7de-refresh-sorunu/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 19:46:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webmaster]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=490</guid>
		<description><![CDATA[Ajax nedir bi de biz kullanalim derken jquery diye bişey buldum. pratik bir şekilde ajax kullanmaya yarıyor. Ama nedense firefox altında çalışan sayfa explorer 7  kullanırken refresh etmiyordu. Gece geç saat olduğu için uykusuzluk ile çözemediğimi düşünüp yattım. Ertesi gün tekrar denediğimde aynı sorun vardı.  Sonunda sorunun cache ile çalışmayı tercih eden explorer yüzünden refresh [...]]]></description>
			<content:encoded><![CDATA[<p>Ajax nedir bi de biz kullanalim derken jquery diye bişey buldum. pratik bir şekilde ajax kullanmaya yarıyor. Ama nedense firefox altında çalışan sayfa explorer 7  kullanırken refresh etmiyordu. Gece geç saat olduğu için uykusuzluk ile çözemediğimi düşünüp yattım. Ertesi gün tekrar denediğimde aynı sorun vardı.</p>
<p><span id="more-490"></span> Sonunda sorunun cache ile çalışmayı tercih eden explorer yüzünden refresh etmediği kanaatine vardım. kısa yolda header bilgisine cache tutmaması gerektiğini sayfanın eskidiğini söyleyen bir kod yazdım. A aaa çözülmüş sorun <img src='http://blog.kesdi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Kodu vereyim de işe yarasın.</p>
<p><code>
<pre class="brush: php; title: ; notranslate">  &lt;?php
header(&quot;Cache-Control: no-cache, must-revalidate&quot;); // HTTP/1.1 (cache tutma)
header(&quot;Expires: Sat, 26 Jul 1997 05:00:00 GMT&quot;); // Sayfanın tarihi geçmiş
?&gt; </pre>
<p></code></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%2Fjquery-ile-ajax-kullanirken-explorer-7de-refresh-sorunu%2F&amp;title=jquery%20ile%20ajax%20kullan%C4%B1rken%20explorer%207%26%238242%3Bde%20refresh%20sorunu" id="wpa2a_12">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/jquery-ile-ajax-kullanirken-explorer-7de-refresh-sorunu/feed/</wfw:commentRss>
		<slash:comments>2</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_14">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>Başka bir php seo fonksiyonu</title>
		<link>http://blog.kesdi.com/php/baska-bir-php-seo-fonksiyonu/</link>
		<comments>http://blog.kesdi.com/php/baska-bir-php-seo-fonksiyonu/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 20:07:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=458</guid>
		<description><![CDATA[function cevir($url) { $url = trim($url); $url = strtolower($url); $find = array(&#8221;, &#8221;); $url = str_replace ($find, &#8221;, $url); $url = preg_replace(&#8216;/&#60;(\/{0,1})img(.*?)(\/{0,1})\&#62;/&#8217;, &#8216;image&#8217;, $url); $find = array(&#8216; &#8216;, &#8216;&#8221;&#8216;, &#8216;&#38;&#8217;, &#8216;&#38;&#8217;, &#8216;\r\n&#8217;, &#8216;\n&#8217;, &#8216;/&#8217;, &#8216;\\&#8217;, &#8216;+&#8217;, &#8216;&#60;&#8217;, &#8216;&#62;&#8217;); $url = str_replace ($find, &#8216;-&#8217;, $url); $find = array(&#8216;é&#8217;, &#8216;è&#8217;, &#8216;ë&#8217;, &#8216;ê&#8217;, &#8216;É&#8217;, &#8216;È&#8217;, &#8216;Ë&#8217;, &#8216;Ê&#8217;); $url [...]]]></description>
			<content:encoded><![CDATA[<p>function cevir($url)<br />
{<br />
$url = trim($url);<br />
$url = strtolower($url);<br />
$find = array(&#8221;, &#8221;);<br />
$url = str_replace ($find, &#8221;, $url);<br />
$url = preg_replace(&#8216;/&lt;(\/{0,1})img(.*?)(\/{0,1})\&gt;/&#8217;, &#8216;image&#8217;, $url);<br />
$find = array(&#8216; &#8216;, &#8216;&#8221;&#8216;, &#8216;&amp;&#8217;, &#8216;&amp;&#8217;, &#8216;\r\n&#8217;, &#8216;\n&#8217;, &#8216;/&#8217;, &#8216;\\&#8217;, &#8216;+&#8217;, &#8216;&lt;&#8217;, &#8216;&gt;&#8217;);<br />
$url = str_replace ($find, &#8216;-&#8217;, $url);<br />
$find = array(&#8216;é&#8217;, &#8216;è&#8217;, &#8216;ë&#8217;, &#8216;ê&#8217;, &#8216;É&#8217;, &#8216;È&#8217;, &#8216;Ë&#8217;, &#8216;Ê&#8217;);<br />
$url = str_replace ($find, &#8216;e&#8217;, $url);<br />
$find = array(&#8216;í&#8217;, &#8216;ı&#8217;, &#8216;ì&#8217;, &#8216;î&#8217;, &#8216;ï&#8217;, &#8216;I&#8217;, &#8216;İ&#8217;, &#8216;Í&#8217;, &#8216;Ì&#8217;, &#8216;Î&#8217;, &#8216;Ï&#8217;);<br />
$url = str_replace ($find, &#8216;i&#8217;, $url);<br />
$find = array(&#8216;ó&#8217;, &#8216;ö&#8217;, &#8216;Ö&#8217;, &#8216;ò&#8217;, &#8216;ô&#8217;, &#8216;Ó&#8217;, &#8216;Ò&#8217;, &#8216;Ô&#8217;);<br />
$url = str_replace ($find, &#8216;o&#8217;, $url);<br />
$find = array(&#8216;á&#8217;, &#8216;ä&#8217;, &#8216;â&#8217;, &#8216;à&#8217;, &#8216;â&#8217;, &#8216;Ä&#8217;, &#8216;Â&#8217;, &#8216;Á&#8217;, &#8216;À&#8217;, &#8216;Â&#8217;);<br />
$url = str_replace ($find, &#8216;a&#8217;, $url);<br />
$find = array(&#8216;ú&#8217;, &#8216;ü&#8217;, &#8216;Ü&#8217;, &#8216;ù&#8217;, &#8216;û&#8217;, &#8216;Ú&#8217;, &#8216;Ù&#8217;, &#8216;Û&#8217;);<br />
$url = str_replace ($find, &#8216;u&#8217;, $url);<br />
$find = array(&#8216;ç&#8217;, &#8216;Ç&#8217;);<br />
$url = str_replace ($find, &#8216;c&#8217;, $url);<br />
$find = array(&#8216;ş&#8217;, &#8216;Ş&#8217;);<br />
$url = str_replace ($find, &#8216;s&#8217;, $url);<br />
$find = array(&#8216;ğ&#8217;, &#8216;Ğ&#8217;);<br />
$url = str_replace ($find, &#8216;g&#8217;, $url);<br />
$find = array(&#8216;/[^a-z0-9\-&lt;&gt;]/&#8217;, &#8216;/[\-]+/&#8217;, &#8216;/&lt;[^&gt;]*&gt;/&#8217;);<br />
$repl = array(&#8221;, &#8216;-&#8217;, &#8221;);<br />
$url = preg_replace ($find, $repl, $url);<br />
$url = str_replace (&#8216;&#8211;&#8217;, &#8216;-&#8217;, $url);<br />
return $url;<br />
}</p>
<p>Örnek Kullanım:</p>
<p>cevir(&#8220;Amça bana Şeker Al&#8221;); // Çıktısı amca-bana-seker-al Olacaktır</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%2Fbaska-bir-php-seo-fonksiyonu%2F&amp;title=Ba%C5%9Fka%20bir%20php%20seo%20fonksiyonu" id="wpa2a_16">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/baska-bir-php-seo-fonksiyonu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP ile Türkçe Fonksiyonlar</title>
		<link>http://blog.kesdi.com/php/php-ile-turkce-fonksiyonlar/</link>
		<comments>http://blog.kesdi.com/php/php-ile-turkce-fonksiyonlar/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 18:07:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=445</guid>
		<description><![CDATA[PHP'nin harfler ile ilgili fonksiyonları türkçe desteği sunmamaktadır. Biz bu yüzden kendi türkçe destekli fonksiyonlarımızı yazacağız. Örnek kullanımın çıktısı ÖRNEK TÜRKÇE METİN şeklinde olacaktır. Örnek kullanımın çıktısı Örnek Türkçe Metin şeklinde olacaktır. Örnek kullanımın çıktısı örnek türkçe metin şeklinde olacaktır.]]></description>
			<content:encoded><![CDATA[<pre>PHP'nin harfler ile ilgili fonksiyonları türkçe desteği sunmamaktadır. Biz bu yüzden kendi türkçe destekli fonksiyonlarımızı yazacağız.
<span id="more-445"></span>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
function tr_strtoupper($metin) {
$metin = strtr($metin, &quot;ığüşiöç&quot;, &quot;IĞÜŞİÖÇ&quot;);&lt;/pre&gt;
 return strtoupper($metin);
}

# Örnek Kullanımı
echo tr_strtoupper(&quot;örnek türkçe metin&quot;);
?&gt;
</pre>
<p>Örnek kullanımın çıktısı <strong><code>ÖRNEK TÜRKÇE METİN</code></strong> şeklinde olacaktır.</p>
<pre class="brush: plain; title: ; notranslate">

&lt;?php
function tr_ucwords($metin) {
 $metin[0] = tr_strtoupper($metin[0]);
 for ($i = 0; $i &lt; strlen($metin); $i++) {
 if (($metin[$i] == &quot; &quot; || $metin[$i] == &quot;(&quot;) &amp;&amp; isset($metin[$i + 1]))
 $metin[$i + 1] = tr_strtoupper($metin[$i + 1]);
 }

 return $metin;
}

# Örnek Kullanımı
echo tr_ucwords(&quot;örnek türkçe metin&quot;);
?&gt;
</pre>
<p>Örnek kullanımın çıktısı <strong><code>Örnek Türkçe Metin</code></strong> şeklinde olacaktır.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?php
function tr_strtolower($metin) {
 $metin = strtr($metin, &quot;IĞÜŞİÖÇ&quot;, &quot;ığüşiöç&quot;);
 return strtolower($metin);
}

# Örnek Kullanımı
echo tr_strtolower(&quot;ÖRNEK TÜRKÇE METİN&quot;);
?&gt;
</pre>
<p>Örnek kullanımın çıktısı <strong><code>örnek türkçe metin</code> </strong>şeklinde olacaktır.</pre>
</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-turkce-fonksiyonlar%2F&amp;title=PHP%20ile%20T%C3%BCrk%C3%A7e%20Fonksiyonlar" id="wpa2a_18">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ile-turkce-fonksiyonlar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php ile resim köşelerini yuvarlayan class</title>
		<link>http://blog.kesdi.com/php/php-ile-resim-koselerini-yuvarlayan-class/</link>
		<comments>http://blog.kesdi.com/php/php-ile-resim-koselerini-yuvarlayan-class/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 12:21:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.kesdi.com/?p=431</guid>
		<description><![CDATA[PHP ile resimlerin köşelerini bu ufak class yardımı ile yuvarlayabiliriz. Kullanımı]]></description>
			<content:encoded><![CDATA[<p>PHP ile resimlerin köşelerini bu ufak class yardımı ile yuvarlayabiliriz.</p>
<p><span id="more-431"></span>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*
 * Created on 15.Ara.2006
 *
 * A simple class that creates rounded corner images for tables
 * Coded By Ozgur Kaya
 * &lt;a href=&quot;mailto:ozgurkaya01@hotmail.com&quot;&gt;ozgurkaya01@hotmail.com&lt;/a&gt;
 */

class roundedCorners {
    var $width = 50;
    var $height = 50;
    var $bgcolor = &quot;#FFFFFF&quot;;
    var $imagecolor = &quot;#ff0000&quot;;
    var $align;
    var $cx;
    var $cy;
    var $image;
    var $type = &quot;jpeg&quot;;
    var $transparent = false;

    function roundedCorners($width,$height,$align,$bgcolor,$color,$type,$transparent){
        $this-&gt;setWidth($width); // sets image width
        $this-&gt;setHeight($height); // sets image height
        $this-&gt;setAlign($align);  // sets align of image (top-left, top-right, bottom-left, bottom-right)
        $this-&gt;setbgColor($bgcolor); // set image background color
        $this-&gt;setImageColor($color); // set rounded image color
        $this-&gt;setType($type); // set extension for image (jpg,gif,png)
        $this-&gt;setTransparent($transparent); // set transparency of the image
    }

    function setAlign($align){
        $align = ($align) ? $align : $this-&gt;align;
  if ($this-&gt;width == $this-&gt;height) {
   $align_array = array (
      &quot;tl&quot;=&gt;array($this-&gt;width,$this-&gt;height),
      &quot;tr&quot;=&gt;array(0,$this-&gt;width),
      &quot;bl&quot;=&gt;array($this-&gt;height,0),
      &quot;br&quot;=&gt;array(0,0)
     );
  }
  elseif ($this-&gt;width &gt; $this-&gt;height) {
   $align_array = array (
      &quot;tl&quot;=&gt;array($this-&gt;width,$this-&gt;height),
      &quot;tr&quot;=&gt;array(0,$this-&gt;height),
      &quot;bl&quot;=&gt;array($this-&gt;height*2,0),
      &quot;br&quot;=&gt;array(0,0)
     );   
  }
  elseif ($this-&gt;width &lt; $this-&gt;height) {
   $align_array = array (
      &quot;tl&quot;=&gt;array($this-&gt;width,$this-&gt;height),
      &quot;tr&quot;=&gt;array(0,$this-&gt;height),
      &quot;bl&quot;=&gt;array($this-&gt;width,0),
      &quot;br&quot;=&gt;array(0,0)
     );   
  }
        $this-&gt;cx = $align_array[$align][0];
        $this-&gt;cy = $align_array[$align][1];
    }

    function setWidth($width){
        $this-&gt;width = ($width) ? $width : $this-&gt;width;
    }

    function setHeight($height) {
        $this-&gt;height = ($height) ? $height : $this-&gt;height;
    }

    function setBgColor($bgcolor){
        $this-&gt;bgcolor = ($bgcolor) ? $bgcolor : $this-&gt;bgcolor;
    }

    function setImageColor($color) {
        $this-&gt;imagecolor = ($color) ? $color : $this-&gt;imagecolor;
    }

    function setType($type){
        if ($type == &quot;jpg&quot;)
            $type = &quot;jpeg&quot;;
        $types = array(&quot;gif&quot;,&quot;jpeg&quot;,&quot;png&quot;);
        $type = (in_array($type,$types)) ? $type : &quot;jpeg&quot;;
        $this-&gt;type = $type;
    }

    function setTransparent($transparent){
        if ($transparent) {
            $this-&gt;type = &quot;gif&quot;;
            $this-&gt;transparent = true;
        }
        else
            $this-&gt;transparent = false;
    }

    function displayImage($type){
        $types = array (&quot;gif&quot;=&gt;&quot;gif&quot;,&quot;png&quot;=&gt;&quot;png&quot;,&quot;jpg&quot;=&gt;&quot;jpeg&quot;);
        $type = $types[$type];
        header(&quot;Content-type: image/png]}&quot;);
        imagepng($this-&gt;image);
    }

    function createRGBValues($color) {
        $color = str_replace(&quot;#&quot;,&quot;&quot;,$color);
        $rgb[&quot;red&quot;] = hexdec(substr($color,0,2));
        $rgb[&quot;green&quot;] = hexdec(substr($color,2,2));
        $rgb[&quot;blue&quot;] = hexdec(substr($color,4,2));
        return $rgb;
    }

    function createImage() {
        $this-&gt;image = imagecreatetruecolor($this-&gt;width,$this-&gt;height);

        //
        $bg_rgb = $this-&gt;createRGBValues($this-&gt;bgcolor);
        $bg = imagecolorallocate($this-&gt;image, $bg_rgb[&quot;red&quot;], $bg_rgb[&quot;green&quot;], $bg_rgb[&quot;blue&quot;]);
        if ($this-&gt;transparent)
            $bg = imagecolortransparent($this-&gt;image,$bg);
        imagefill($this-&gt;image, 0, 0, $bg);

        //
        $img_rgb = $this-&gt;createRGBValues($this-&gt;imagecolor);;
        $col_ellipse = imagecolorallocate($this-&gt;image, $img_rgb[&quot;red&quot;], $img_rgb[&quot;green&quot;], $img_rgb[&quot;blue&quot;]);

        $w = $this-&gt;width * 2;
        $h = $this-&gt;height * 2;
        imagefilledellipse($this-&gt;image, $this-&gt;cx, $this-&gt;cy, $w, $h, $col_ellipse);

        header(&quot;Content-type: image/{$this-&gt;type}&quot;);  // set header (you can use different types png,jpeg,gif
        switch ($this-&gt;type){
            case &quot;gif&quot;:
                imagegif($this-&gt;image);
                break;
            case &quot;png&quot;:
                imagepng($this-&gt;image);
                break;
            case &quot;jpeg&quot;:
                imagejpeg($this-&gt;image);
                break;
        }
    }

}
?&gt;
</pre>
<p>Kullanımı</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
//using class
$img = new roundedCorners($_GET['w'],$_GET['h'],$_GET['al'],$_GET['bg'],$_GET['cl'],$_GET['type'],$_GET['tr']); // create a new rounded corner image object with width, height, and align attributes
$img-&gt;createImage(); // create image
//

?&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-resim-koselerini-yuvarlayan-class%2F&amp;title=php%20ile%20resim%20k%C3%B6%C5%9Felerini%20yuvarlayan%20class" id="wpa2a_20">Paylaş/Kaydet</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.kesdi.com/php/php-ile-resim-koselerini-yuvarlayan-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

