• 30-06-2010, 11:31:23
    #73
    Cycl0ne adlı üyeden alıntı: mesajı görüntüle
    tam olarak ne işe yarıyor ?
    session bilgilerini hafızada tutmaya yarıyor
  • 30-06-2010, 11:37:57
    #74
    Nasıl yani ? Phpnin session 'u bilgileri hafızasında tutmuyor mu ki böyle birşey yazılma ihtiyacı duyulmuş ? Edit . Belirtilen yola kayıt ediyormuş..
  • 09-09-2010, 00:35:38
    #75
    python adlı üyeden alıntı: mesajı görüntüle
    session bilgilerini hafızada tutmaya yarıyor
    boylece cookie gibi uzun sureli sessionlar uretilebilir daha guvenilir ?
  • 20-10-2010, 12:37:02
    #76
    Üyeliği durduruldu
    Captcha Sınıfı :
    <?php
    /*
    	(C) 2010 Class Security Captcha Image
     
    	@author : PHPci || 0xyGen
    	@mail   : yns [at] linuxboyz [dot] com
    	@web    : http://yns.linuxboyz.com/ || http://yunusoksuz.com
     
    */
    class CaptchaImage
    {
     
    	public $font_dir 		= 'fonts';
    	public $colors   		= array('178,34,34','0,100,0','205,92,92','255,0,0','255,105,108');
    	public $bgcolor	 		= array(255,255,255);
    	public $linecolor		= array(135,206,250);
    	public $width  			= 150;
    	public $height  		= 50;
    	public $chars			= 5;
    	public $size 			= 20;
    	public $session_name	= 'securitykey';
    	public $case_sensivty 	= true;
     
     
    	private $im;
    	private $fonts = array();
     
    	public function start()
    	{
    		if(!function_exists('gd_info')): die('GD LIBRARY NOT FOUND'); endif;
    		++$this->width;
    		++$this->height;
     
    		$this->im = imagecreatetruecolor($this->width,$this->height);
    		$bg = imagecolorallocate($this->im,$this->bgcolor[0],$this->bgcolor[1],$this->bgcolor[2]);
    		imagefill($this->im,0,0,$bg);
     
    		$linecolors = imagecolorallocate($this->im,$this->linecolor[0],$this->linecolor[1],$this->linecolor[2]);
    		for($i = 0 ; $i <= $this->width ; $i = $i+10 )
    		{
    			imageline($this->im,0,$i,$this->width,$i,$linecolors);
    			imageline($this->im,$i,0,$i,$this->height,$linecolors);
    		}
    	}
     
    	public function create()
    	{
     
    		header('Content-Type:image/png');
    		$this->write();
    		imagepng($this->im);
    		imagedestroy($this->im);
    	}
     
    	public function chars()
    	{
    		$chr = 'abcdefghijklmnoprstuxvyz1234567890ABCDEFGHIJKLMNOPRSTUWXYZ';
    		for($i = 0 ; $i < $this->chars; $i++)
    		{
    			$key .= $chr[rand(0,strlen($chr)-1)];
    		}
    		if($this->case_sensivty)
    		{
    			$_SESSION[$this->session_name] = $key;
    		}
    		else
    		{
    			$_SESSION[$this->session_name] = strtolower($key);
    		}
    		return $key;
    	}
     
     
    	private function write()
    	{
    		$fonts = $this->getfonts();
    		$chars = $this->chars();
    		$y_orgin = ($this->size > 35) ? 60 : 40;
    		$space   = ($this->size > 35) ? 60 : 30;
    		if($fonts !== FALSE):
    			for($i = 0 ; $i < $this->chars ; $i++)
    			{
    				$angle 	= rand(-15,15);
    				$font 	= rand(0,count($fonts)-1);
    				$color  = rand(0,count($this->colors)-1);
    				$color  = explode(',',$this->colors[$color]);
    				$color  = imagecolorallocate($this->im,$color[0],$color[1],$color[2]);
    				imagettftext($this->im, $this->size ,$angle, 10 + ($i * $space) , $y_orgin , $color, $this->font_dir . DIRECTORY_SEPARATOR . $fonts[$font] ,$chars[$i]);
    			}
    		endif;
    	}
     
    	private function getfonts()
    	{
    		$read = opendir($this->font_dir);
    		if($read)
    		{
    			while($list = readdir($read))
    			{
    				if($list != '.' && $list != '..' && preg_match('/(.ttf)$/',$list))
    				{
    					$this->fonts[] = $list;
    				}
    			}
    			return $this->fonts;
    		}
    		else
    		{
    			return false;
    		}
     
    	}
    }
     
    ?>
    Gerekli Dosya Ornek Ve Bilgiler

    Belli Dizindeki Resimleri Facebook gibi linkleme :
    <?php
    	$resource = opendir('.');
    	$buffer = array();
     
    	while($list = readdir($resource))
    	{
    		if($list != '.' && $list != '..' && preg_match('/(JPG|jpeg|jpg|JPEG|gif|GIF|png|PNG)$/',$list))
    		{
    			$buffer[] = $list;
    		}
    	}
     
    	function showimg($array , $pic)
    	{
    		$count = count($array);
    		$key = array_search( $pic, $array);
     
    		if((--$count) == $key)
    		{
    			return $array[0];
    		}
    		else
    		{
    			if($key !== FALSE)
    				return $pic_name = $array[++$key];
    			else
    			{
    				return false;
    			}
    		}
    	}
     
     
     
    	$list = (isset($_GET['lst'])) ? $_GET['lst'] : $buffer[0];
    	$pic = showimg($buffer, $list );
     
     
    ?>
    <a href="?lst=<?php echo $pic ?>"><img src="<?php echo $pic; ?>" alt="<?php echo $pic; ?>" /></a>
    Youtube Birgün eskisi gibi ip'ye göre filtreleme yapmaz ise alttaki sınıf ile butun video detaylarini alabilirsiniz.

    Youtube Class :
    <?php
    /*
    
        (C) 2010 Youtube.com video info tool             
    
         @author : PHPci || 0xyGen           
         @web     : http://yns.linuxboyz.com                
         @mail   : yns [at] linuxboyz [dot] com            
    
         *Bu sınıfın kullanımı için en phpversion >= 5 gerektirir
         *curl_init , file_get_contetns  ya da allow_url_fopen server üzerinde açık olması gerekir
         *videoların kendi serveriniza cekmek icin kesinlikle cURL gerekir.
         
         *video_download metotdu henuz yazilmadi
         *save_thumb performansı dusuk bu yuzden servera thumblar cekilmiyor direk ytimage.com domaininden geliyor
    
        Licence : 
        This program is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
        GNU General Public License for more details.
        You should have received a copy of the GNU General Public License
        along with this program. If not, see <http://www.gnu.org/licenses/>.
        
    */
    
    
    class videodb_yt
    {
        
        public $thumb_path;
        public $video_path;
        public $temp_path;
        public $dl_url;
        public $showerror         = false; // boolen
        public $usedfunc; // for information
        public $maxresult = '50';
        public $icon_v = true;
        
        private $vid;
        private $info_addr         = 'http://www.youtube.com/get_video_info';
        private $get_addr         = 'http://www.youtube.com/get_video.php';
        private $searc_addr        = 'http://gdata.youtube.com/feeds/api/videos';
        private $quality         = '5'; // max quality=5
        private $error            = array();
        private $video_detail     = array();
        
        private $curl;            
        private $fgc;            
        private $url_fopen;        
        private $curl_opt;
        private $info;
        private $thumb;
        
    
        /*
        *    Kullanılacak fonksiyon listesi kontrol ediliyor / varmi yokmu
        */
        public function __construct()
        {
            @set_time_limit(0);
            $this->curl                = function_exists('curl_init');
            $this->fgc                = function_exists('file_get_contents');
            $this->url_fopen        = ini_get('allow_url_fopen');
            $this->curl_opt         = array(CURLOPT_COOKIEFILE => dirname(__FILE__).'/cookies.txt', CURLOPT_COOKIJAR => dirname(__FILE__).'/cookies.txt', CURLOPT_RETURNTRANSFER => TRUE , CURLOPT_REFERER => 'http://www.google.com', CURLOPT_FOLLOWLOCATION => TRUE , CURLOPT_USERAGENT => 'Firefox / 2.0.1.6');
            if(!$this->curl && !$this->fgc && $this->url_fopen != '1'): if($this->showerror) : die('Bu sinifim calismasi icin file_get_contents(), curl_init ya da allow_url_fopen durumlarindan herhangi birinin acik olmasi gerekmekte'); else: exit; endif; endif;
        
        }
        
        /*
        *    @Author : Yunus Öksüz
        *    metot işlevi : youtube.com'dan gerekli video detaylarını alır
        *   işlev başarılı ise $out array döndürür
        *    işlev başarılı olmaz ise FALSE döndürür
        */
        
        public function video_info()
        {
            if($this->fgc)
            {
                $info = @file_get_contents($this->info_addr . '?video_id=' . $this->vid);
                $this->info = $info;
                $this->usedfunc = 'fgc_for_video_info';
                if($info == false)
                {
                    $this->error[] = 'file_get_contents hatasi';
                    $this->info = '';
                    $this->fgc     = false;
                    $this->video_info();
                }
            }
            elseif($this->curl)
            {
                $ch = curl_init();
                curl_setopt($ch , CURLOPT_URL , $this->info_addr . '?video_id=' . $this->vid);
                @curl_setopt_array($ch , $this->curl_opt);
                $info = curl_exec($ch);
                
                
                $this->info = urldecode($info);
                if($info === false)
                {
                    $this->error[] = 'curl hatasi';
                    $this->info = '';
                    $this->curl = false;
                    $this->video_info();
                }
            }
            else
            {
                return false;
            }
        
        parse_str($this->info,$out);
        $this->video_detail = $out;
        return $out;
        }
    
        /*
        *    Author : Yunus Öksüz
        *    metot işlevi : girilen youtube linkini parse ederek youtube id'yi alir
        *   işlev başarılı ise $this->vid değişkenine video id'si yüklenir
        */
        
        public function parse_link($link)
        {
            $id = explode('v=',$link);
            if(strpos($id[1],'&') !== false)
            {
                $id = explode('&',$id[1]);
                $this->vid = $id[0];
            }else{
            $this->vid = $id[1];
            }
        return $this->vid;
        }
        
        
        /*
        *    stream yapılacak url'yi dondurur
        */    
        public function streamurl($ip)
        {
            // henuz kullanıma hazir degil.
        }
        
        /*
        *     @param string $keyword url_encoded
        *    yutubu'dan arama yaparak video_id baslik aciklama thumbnail url dondurur.
        */
        public function search($keyword,$page=null)
        {
            if(!$this->fgc){ $this->error[] = 'fgc acik degil'; return false;}
            else
            {
                
                $xml = $this->searc_addr . '?q=' . $keyword . '&max-results=' . $this->maxresult . '&start-index=' . intval($page);
                $xml = @file_get_contents($xml);
                preg_match_all('/url=\'(.*?)\'/si',$xml,$out);
                $thumbs = array();
                
                foreach($out[1] as $t)
                {
                    if(preg_match('/(.jpg)$/',$t))
                    {
                        preg_match('/vi\/(.*?)\//',$t,$key);
                        $thumbs[$key[1]] = $t;    
                    }
                }
                
                $xml = simplexml_load_string($xml);
                $c = count($xml->entry);
                $return = array();
                
                
                for($i = 0 ; $i < $c ; $i++)
                {
                        $return[$i]['href']            = $this->parse_link(($xml->entry[$i]->link[0]['href']));
                        $return[$i]['title']        = ($this->icon_v) ? iconv('UTF-8','ISO-8859-9',$xml->entry[$i]->title) : $xml->entry[$i]->title;
                        $return[$i]['title_link']    = str_replace($tirnak,$bos,$this->forseo(iconv('UTF-8','ISO-8859-9',$xml->entry[$i]->title)));
                        $return[$i]['content']        = ($this->icon_v) ? iconv('UTF-8','ISO-8859-9',$xml->entry[$i]->content) : $xml->entry[$i]->content;
                        $return[$i]['thumburl']     = str_replace('0.jpg','1.jpg',$thumbs[$return[$i]['href']]);
                }
                
                if($page < $this->maxresult)
                {
                    if(isset($xml->link[4]['rel']) && $xml->link[4]['rel'] == 'next')
                    {
                        $return['next'] = true;
                    }
                    else
                    {
                        $return['next'] = false;
                    }
                }
                else
                {
                    if(isset($xml->link[5]['rel']) && $xml->link[5]['rel'] == 'next')
                    {
                        $return['next'] = true;
                    }
                    else
                    {
                        $return['next'] = false;
                    }
                }
            }
        
        return $return;
            
        }
        
        // Boolean methods
        public function status()
        {
            return ($this->video_detail['status'] == 'ok') ? true : false;
        }
        
        public function thumburl()
        {
            return ($this->status()) ? $this->video_detail['thumbnail_url'] : false;
        }
        
        public function allowembed()
        {
            if($this->status()): return($this->video_detail['allow_embed'] == '1') ? true : false; else: return false; endif;
        }
        
        public function title()
        {
            return ($this->status() && $this->allowembed()) ? ($this->icon_v) ? iconv('UTF-8','ISO-8859-9',$this->video_detail['title']) : $this->video_detail['title'] : false;
        }
        
        public function keywords()
        {
            if($this->status() && $this->allowembed()):  return iconv('UTF-8','ISO-8859-9',$this->video_detail['keywords']); else: return false; endif;
        }
        
        public function cacheurl($ip)
        {
            return $this->streamurl($ip);
        }
        
        public function forseo($url)
        {
            $bad  = array(' - ','İ','Ö','Ü','Ş','Ç','Ğ','ğ','ü','ç','ö','ş','ı',' ','-',')','(','"','\'','[',']','\\','/');
            $good = array('_','i','o','u','s','c','g','g','u','c','o','s','i','_','','','','','','','','.','.');
            $stable = str_replace($bad,$good,$url);
            $stable = strtolower($stable);
            $x = array('&','__',':','*','.','?','%','=','!','#','^','+','@','$',',','|');
            $y = array('and','_','','','','','','','','','','','','','','');
            $stable = str_replace($x,$y,$stable);
            $stable = str_replace('__','_',$stable);
            return ($this->icon_v) ? iconv('UTF-8','ISO-8859-9',$stable) : $stable ;
        }
        
        public function __destruct()
        {
            if($this->showerror):
                echo '<ul>';
                foreach($this->error as $error):
                    echo '<li>'. $error . '</li>';
                endforeach;
                echo '</ul>';
            endif;
        }
    }
    
    
    ?>
    T.c Kimlik No Dogrulama :

    <?php
    /*
    * @author : PHPci | 0xyGen ****.a yns
    * @mail  : yns [at] linuxboyz [dot] com
    * @web : http://yns.linuxboyz.com || http://yunusoksuz.com
    */
    function tckimlikdogrula($tcno)
    {
        if(strlen($tcno) < 11){ return false; }
        if($tcno[0] == '0'){ return false; }
        $toplam = ($tcno[0] + $tcno[2] + $tcno[4] + $tcno[6] + $tcno[8]) * 7;
        $cikar  = $toplam - ($tcno[1] + $tcno[3] + $tcno[5] + $tcno[7]);
        $mod = $cikar % 10;
        if($mod != $tcno[9]){ return false; }
        $hanelertoplami = '';
        for($i = 0 ; $i < 10 ; $i++){ $hanelertoplami += $tcno[$i];  }
        if($hanelertoplami % 10 != $tcno[10]){ return false; }
     
        return true;
    }
     
    ?>
  • 31-10-2010, 04:08:26
    #77
    Üyeliği durduruldu
    Txt dosyası kullanarak online ziyaretçi sayısını gösteren fonksiyon. (fonksiyonu çağırdığınız dosyanın bulunduğu dizinde ip.txt olmalıdır)

    function onlinesay($zamanasimi = '300'){
    $rip = $_SERVER['REMOTE_ADDR'];
    $sd  = time();
    $rand = rand(3,5);
    $onlineUsers = $rand;
    
    $file1 = "ip.txt";
    $lines = file($file1);
    $line2 = "";
    
    foreach ($lines as $line_num => $line)
    {
    	$fp = strpos($line,'****');
    	$nam = substr($line,0,$fp);
    	$sp = strpos($line,'++++');
    	$val = substr($line,$fp+4,$sp-($fp+4));
    	$diff = $sd-$val;
    	if($diff < $zamanasimi && $nam != $rip)
    	{
    		$onlineUsers = $onlineUsers+1;
    		$line2 = $line2.$line;
    	}
    }
    $my = $rip."****".$sd."++++\n";
    $open1 = fopen($file1, "w");
    fwrite($open1,"$line2");
    fwrite($open1,"$my");
    fclose($open1);
    
    echo "$onlineUsers";
    }
    time() fonksiyonunu kullanarak geçen zamanı hesaplayan basit bir fonksiyon. Mesaj sistemlerinde yada son login zamanı gibi şeyler yapmak istediğinizde kullanabilirsiniz.

    function once($time)
    {
    $time_difference = time() - $time;
    
    $seconds = $time_difference ;
    $minutes = round($time_difference / 60 );
    $hours = round($time_difference / 3600 );
    $days = round($time_difference / 86400 );
    $weeks = round($time_difference / 604800 );
    $months = round($time_difference / 2419200 );
    $years = round($time_difference / 29030400 );
    // Seconds
    if($seconds <= 60){
    echo "$seconds saniye önce";
    }elseif($minutes <=60){
    	echo "$minutes dakika önce";
    }elseif($hours <=24){
    echo "$hours saat önce";
    }elseif($days <= 7){
    echo "$days gün önce";
    }elseif($weeks <= 4){
    echo "$weeks hafta önce";
    }elseif($months <=12){
    echo "$months ay önce";
    }else{
    echo "$years yıl önce";
    }
    
    }
  • 12-12-2010, 16:40:48
    #78
    function yaziylasayi($sayi) {
        $o = array(
            'birlik' => array('bir', 'iki', 'üç', 'dört', 'beş', 'altı', 'yedi', 'sekiz', 'dokuz'),
            'onluk' => array('on', 'yirmi', 'otuz', 'kırk', 'elli', 'altmış', 'yetmiş', 'seksen', 'doksan'),
            'basamak' => array('yüz', 'bin', 'milyon', 'milyar', 'trilyon', 'katrilyon')
        );
    
        // Sayıyı basamaklarına ayırıyoruz
        $basamak = array_reverse(str_split(implode('', array_reverse(str_split($sayi))), 3));
    
        // Basamak sayısını belirliyoruz
        $basamak_sayisi = count($basamak);
    
        // Her basamak için:
        for ($i=0; $i < $basamak_sayisi; ++$i)
        {
            // Sayıyı basamaklarına ayırdığımızda basamaklar tersine döndüğü için burada ufak bir işlem ile basamakları düzeltiyoruz
            $basamak[$i] = implode(array_reverse(str_split($basamak[$i])));
            
            // Eğer basamak 4, 8, 15, 16, 23, 42 gibi 1 veya 2 rakamlıysa başına 3 rakama tamamlayacak şekilde "0" ekliyoruz ki foreach döngüsünde problem olmasın
            if (strlen($basamak[$i]) == 1)
                $basamak[$i] = '00' . $basamak[$i];
            elseif (strlen($basamak[$i]) == 2)
                $basamak[$i] = '0' . $basamak[$i];
        }
    
        $yenisayi = array();
    
        // Her basamak için: ($yenisayi değişkenine)
        foreach ($basamak as $k => $b)
        {
            // basamağın ilk rakamı 0'dan büyük ise
            if ($b[0] > 0)
                // değişkene rakamın harfle yazılışı ve "yüz" ekliyoruz
                $yenisayi[] = ($b[0] > 1 ? $o['birlik'][$b[0]-1] . ' ' : '') . $o['basamak'][0];
    
            // basamağın 2. rakamı 0'dan büyük ise
            if ($b[1] > 0)
                // değişkene rakamın harfle yazılışını ekliyoruz
                $yenisayi[] = $o['onluk'][$b[1]-1];
    
            // basamağın 3. rakamı 0'dan büyük ise
            if ($b[2] > 0)
                // değişkene rakamın harfle yazılışını ekliyoruz
                $yenisayi[] = $o['birlik'][$b[2]-1];
    
            // değişkene basamağın ismini (bin, milyon, milyar) ekliyoruz
            if ($basamak_sayisi > 1)
                $yenisayi[] = $o['basamak'][$basamak_sayisi-1];
    
            // Basamak sayısını azaltıyoruz ki her basamağın sonuna ilkinde ne yazıyorsa o yazılmasın
            --$basamak_sayisi;
        }
        
        return implode(' ', $yenisayi);
    }
    yaziylasayi('14') şeklinde kullanılır. "on dört" çıktısını verir. $o değişkeninin basamak dizgesine diğer basamakları da ekleyerek daha büyük sayılarla çalıştırabilirsiniz. Basamak sınırı yoktur.
  • 17-12-2010, 01:23:36
    #79
    linkyap fonksiyonu ile "www.siteadresi.com/ornek-konu-basligi/568" şeklinde link oluşturabilirsiniz.
    Kullanım şekli:
    $metin = "örnek konu başlığı";
    $metin = linkyap( $metin );
    $metin değişkeninin yeni değeri: "ornek-konu-basligi"

    function linkyap( $metin ){
        $eski = array("I","Ğ","Ü","Ş","İ","Ö","Ç","Q","W","E","R","T","Y","U","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M",
    			"ı","ğ","ü","ş","ö","ç","â");
        $yeni = array("i","g","u","s","i","o","c","q","w","e","r","t","y","u","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m",
    			"i","g","u","s","o","c","a");
        $metin = str_replace($eski,$yeni,$metin);
    	$metin = mb_strtolower($metin,'UTF-8');
    	$metin = preg_replace('#[^-a-zA-Z0-9_ ]#','',$metin);
    	$metin = trim( $metin );
    	$metin2 = "";
    	$metin = str_replace("-"," ",$metin);
        $kelime = explode( " ",$metin );
        foreach( $kelime as $i => $deger ){
            if( $deger != "" ){
                $metin2 .= $deger." ";
            }
        }	
    	$metin = $metin2;
    	$metin = trim( $metin );
        $metin = str_replace(" ","-",$metin);
        $metin = trim( $metin );
        return $metin;
    }
  • 28-12-2010, 06:23:22
    #80
    basit ama kullanışlı bi fonksiyon

    uzun bi metinden sadece bi parçasını almak için

    		 
    		 
    		 function dalaraya($burdan,$buraya,$dal)
    		 {
    		 $dal=explode($burdan,$dal);
             $dal=explode($buraya,$dal[1]);
    		 $dal=$dal[0];
    		 return $dal;
    		 }
  • 23-09-2012, 10:02:36
    #81
    Paylaşımlar için teşekkürler...