Proje Toplam Dosya/Kod Satır Sayısı Hesaplama

$fileCounter = array(); $totalLines = countLines(‘.’, $fileCounter); echo $totalLines.” lines in the current folder<br>”; echo $totalLines – $fileCounter['gen']['commentedLines'] – $fileCounter['gen']['blankLines'] .” actual lines of code (not a comment or blank line)<br><br>”; foreach($fileCounter['gen'] as $key=>$val) { echo ucfirst($key).”:”.$val.”<br>”; } echo “<br>”; foreach($fileCounter as $key=>$val) { if(!is_array($val)) echo strtoupper($key).”:”.$val.” file(s)<br>”; } function countLines($dir, &$fileCounter) { $_allowedFileTypes = […]

Read More

IP’den Lokasyon Bulma

function detect_city($ip){ $default = ‘Hollywood, CA’; if (!is_string($ip) || strlen($ip) < 1 || $ip == ’127.0.0.1′ || $ip == ‘localhost’) $ip = ’8.8.8.8′; $curlopt_useragent = ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)’; $url = ‘http://ipinfodb.com/ip_locator.php?ip=’ . urlencode($ip); $ch = curl_init(); $curl_opt = array( CURLOPT_FOLLOWLOCATION => 1, CURLOPT_HEADER => 0, […]

Read More

Readable Random String

function readable_random_string($length = 6){ $conso = array(“b”,”c”,”d”,”f”,”g”,”h”,”j”,”k”,”l”,”m”,”n”,”p”,”q”,”r”,”s”,”t”,”v”,”w”,”x”,”y”,”z”); $vocal = array(“a”,”e”,”i”,”o”,”u”); $password = “”; $rand = ((double)microtime()*1000000); $max = $length / 2; for($i=1; $i<=$max; $i++){ $password .= $conso[rand(0,19)]; $password .= $vocal[rand(0,4)]; } return $password; }

Read More

Encryption Class

class Encryption { var $skey = “encKey2016″; public function safe_b64encode($string) { $data = base64_encode($string); $data = str_replace(array(‘+’,’/’,’=’),array(‘-’,’_’,”),$data); return $data; } public function safe_b64decode($string) { $data = str_replace(array(‘-’,’_’),array(‘+’,’/’),$string); $mod4 = strlen($data) % 4; if ($mod4) { $data .= substr(‘====’, $mod4); } return base64_decode($data); } public function encode($value){ if(!$value){return false;} $text = $value; $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); […]

Read More

Decrypt – Encrypt Fonksiyonu

function encrypt_url($string) { $key = “1zm3TcwckS”; $result = ”; for($i=0; $i<strlen($string); $i++) { $result .= substr($string, $i, 1); } return base64_encode($result); } function decrypt_url($string) { $key = “1zm3TcwckS”; $result = ”; $string = base64_decode($string); for($i=0; $i<strlen($string); $i++) { $result .= substr($string, $i, 1); } return $result; }

Read More

Utf-8 Karakter Düzeltme

function cleanString($text, $convert = false, $cp1252 = false, $strip_tags = false, $html_entity = false, $windows_1252 = false, $new_line = false, $xml = false) { // 1) convert á ô => a o if($convert == true){ $text = preg_replace(“/[áàâãªä]/u”,”a”,$text); $text = preg_replace(“/[ÁÀÂÃÄ]/u”,”A”,$text); $text = preg_replace(“/[ÍÌÎÏ]/u”,”I”,$text); $text = preg_replace(“/[íìîï]/u”,”i”,$text); $text = preg_replace(“/[éèêë]/u”,”e”,$text); $text = preg_replace(“/[ÉÈÊË]/u”,”E”,$text); $text = […]

Read More

String 3 Nokta

function add3dots($string, $repl, $limit){ if(strlen($string) > $limit){ return substr($string, 0, $limit) . $repl; }else{ return $string; } }

Read More

IP Adres Bilgisi Almak

$sorgumuz = @unserialize(file_get_contents(‘http://ip-api.com/php/’ . $ipadresi)); echo “<pre>”; print_r($sorgumuz); echo “</pre>”;

Read More

SEO Uyumlu Link Yapmak

function fix_link($str){ $preg = array(‘Ç’, ‘Ş’, ‘Ğ’, ‘Ü’, ‘İ’, ‘Ö’, ‘ç’, ‘ş’, ‘ğ’, ‘ü’, ‘ö’, ‘ı’, ‘+’, ‘#’, ‘.’); $match = array(‘c’, ‘s’, ‘g’, ‘u’, ‘i’, ‘o’, ‘c’, ‘s’, ‘g’, ‘u’, ‘o’, ‘i’, ‘plus’, ‘sharp’, ”); $perma = strtolower(str_replace($preg, $match, $str)); $perma = preg_replace(“@[^A-Za-z0-9\-_\.\+]@i”, ‘ ‘, $perma); $perma = trim(preg_replace(‘/\s+/’, ‘ ‘, $perma)); $perma = […]

Read More

Alexa Sıralaması Çekme

$url = strip_tags(trim($site_url)); $alexa = simplexml_load_file(‘http://data.alexa.com/data?cli=10&url=’ . $url); $globalRank = number_format((int)$alexa->SD->POPULARITY['TEXT']); $countryCode = $alexa->SD->COUNTRY['CODE']; $countryName = $alexa->SD->COUNTRY['NAME']; $countryRank = number_format((int)$alexa->SD->COUNTRY['RANK']); echo “Global Rank: ” . $globalRank; echo ‘<hr />’; echo “Country Rank: ” . $countryName . ‘ ‘ . $countryRank;

Read More