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;
}
?>