PHP Classes

File: restAPI/helpers/tool_helper.php

Recommend this page to a friend!
  Classes of Hicri   PHP Project JWT   restAPI/helpers/tool_helper.php   Download  
File: restAPI/helpers/tool_helper.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Project JWT
REST API example to perform user login operations
Author: By
Last change:
Date: 4 months ago
Size: 6,115 bytes
 

Contents

Class file image Download
<?php







function temizle($veri)

{

   
$temiz=strip_tags($veri);

   
$cevap=htmlspecialchars($temiz);
   

    return
$cevap;

}



function
sifrele($veri)

{


  return
sha1(md5(md5(md5(sha1(md5($veri))))));

}







function
generateRandomString($length = 100) {

 
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

 
$charactersLength = strlen($characters);

 
$randomString = '';

  for (
$i = 0; $i < $length; $i++) {

   
$randomString .= $characters[rand(0, $charactersLength - 1)];

  }

  return
$randomString;

}






function
token()

{



 
$token = md5(uniqid(rand(),true));



 return
$token;



}




function
giriscerezsifrele(){

 
$durum = 1;
 
$tarayici = $_SERVER['HTTP_USER_AGENT'];

 
$bilgi = $durum."q".$tarayici;

  return
base64_encode($bilgi);
}





function
ftoken()

{


 
$token = sha1(uniqid(rand(),true));



 return
$token;



}


function
tokensor($token){

 
$ci=& get_instance();

 
$sonuc = $ci->db->from('login_detay')->where('token',$token)->get()->num_rows();

 return
$sonuc;


}








function
seolink($str, $options = array())

{

 
$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings());

 
$defaults = array(

   
'delimiter' => '-',

   
'limit' => null,

   
'lowercase' => true,

   
'replacements' => array(),

   
'transliterate' => true

 
);

 
$options = array_merge($defaults, $options);

 
$char_map = array(

       
// Latin

   
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C',

   
'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',

   
'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', '?' => 'O',

   
'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', '?' => 'U', 'Ý' => 'Y', 'Þ' => 'TH',

   
'ß' => 'ss',

   
'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c',

   
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i',

   
'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', '?' => 'o',

   
'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', '?' => 'u', 'ý' => 'y', 'þ' => 'th',

   
'ÿ' => 'y',

       
// Latin symbols

   
'©' => '(c)',

       
// Greek

   
'?' => 'A', '?' => 'B', '?' => 'G', '?' => 'D', '?' => 'E', '?' => 'Z', '?' => 'H', '?' => '8',

   
'?' => 'I', '?' => 'K', '?' => 'L', '?' => 'M', '?' => 'N', '?' => '3', '?' => 'O', '?' => 'P',

   
'?' => 'R', '?' => 'S', '?' => 'T', '?' => 'Y', '?' => 'F', '?' => 'X', '?' => 'PS', '?' => 'W',

   
'?' => 'A', '?' => 'E', '?' => 'I', '?' => 'O', '?' => 'Y', '?' => 'H', '?' => 'W', '?' => 'I',

   
'?' => 'Y',

   
'?' => 'a', '?' => 'b', '?' => 'g', '?' => 'd', '?' => 'e', '?' => 'z', '?' => 'h', '?' => '8',

   
'?' => 'i', '?' => 'k', '?' => 'l', '?' => 'm', '?' => 'n', '?' => '3', '?' => 'o', '?' => 'p',

   
'?' => 'r', '?' => 's', '?' => 't', '?' => 'y', '?' => 'f', '?' => 'x', '?' => 'ps', '?' => 'w',

   
'?' => 'a', '?' => 'e', '?' => 'i', '?' => 'o', '?' => 'y', '?' => 'h', '?' => 'w', '?' => 's',

   
'?' => 'i', '?' => 'y', '?' => 'y', '?' => 'i',

       
// Turkish

   
'?' => 'S', '?' => 'I', 'Ç' => 'C', 'Ü' => 'U', 'Ö' => 'O', '?' => 'G',

   
'?' => 's', '?' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o', '?' => 'g',

       
// Russian

   
'?' => 'A', '?' => 'B', '?' => 'V', '?' => 'G', '?' => 'D', '?' => 'E', '?' => 'Yo', '?' => 'Zh',

   
'?' => 'Z', '?' => 'I', '?' => 'J', '?' => 'K', '?' => 'L', '?' => 'M', '?' => 'N', '?' => 'O',

   
'?' => 'P', '?' => 'R', '?' => 'S', '?' => 'T', '?' => 'U', '?' => 'F', '?' => 'H', '?' => 'C',

   
'?' => 'Ch', '?' => 'Sh', '?' => 'Sh', '?' => '', '?' => 'Y', '?' => '', '?' => 'E', '?' => 'Yu',

   
'?' => 'Ya',

   
'?' => 'a', '?' => 'b', '?' => 'v', '?' => 'g', '?' => 'd', '?' => 'e', '?' => 'yo', '?' => 'zh',

   
'?' => 'z', '?' => 'i', '?' => 'j', '?' => 'k', '?' => 'l', '?' => 'm', '?' => 'n', '?' => 'o',

   
'?' => 'p', '?' => 'r', '?' => 's', '?' => 't', '?' => 'u', '?' => 'f', '?' => 'h', '?' => 'c',

   
'?' => 'ch', '?' => 'sh', '?' => 'sh', '?' => '', '?' => 'y', '?' => '', '?' => 'e', '?' => 'yu',

   
'?' => 'ya',

       
// Ukrainian

   
'?' => 'Ye', '?' => 'I', '?' => 'Yi', '?' => 'G',

   
'?' => 'ye', '?' => 'i', '?' => 'yi', '?' => 'g',

       
// Czech

   
'?' => 'C', '?' => 'D', '?' => 'E', '?' => 'N', '?' => 'R', '?' => 'S', '?' => 'T', '?' => 'U',

   
'?' => 'Z',

   
'?' => 'c', '?' => 'd', '?' => 'e', '?' => 'n', '?' => 'r', '?' => 's', '?' => 't', '?' => 'u',

   
'?' => 'z',

       
// Polish

   
'?' => 'A', '?' => 'C', '?' => 'e', '?' => 'L', '?' => 'N', 'Ó' => 'o', '?' => 'S', '?' => 'Z',

   
'?' => 'Z',

   
'?' => 'a', '?' => 'c', '?' => 'e', '?' => 'l', '?' => 'n', 'ó' => 'o', '?' => 's', '?' => 'z',

   
'?' => 'z',

       
// Latvian

   
'?' => 'A', '?' => 'C', '?' => 'E', '?' => 'G', '?' => 'i', '?' => 'k', '?' => 'L', '?' => 'N',

   
'?' => 'S', '?' => 'u', '?' => 'Z',

   
'?' => 'a', '?' => 'c', '?' => 'e', '?' => 'g', '?' => 'i', '?' => 'k', '?' => 'l', '?' => 'n',

   
'?' => 's', '?' => 'u', '?' => 'z'

 
);

 
$str = preg_replace(array_keys($options['replacements']), $options['replacements'], $str);

  if (
$options['transliterate']) {

   
$str = str_replace(array_keys($char_map), $char_map, $str);

  }

 
$str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str);

 
$str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);

 
$str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8');

 
$str = trim($str, $options['delimiter']);

  return
$options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str;

}














?>