include("date-inc.php");
include("Mobile_Detect.php");
function getOS($userAgent) {
$oses = array (
'iPhone' => '(iPhone)',
'Windows 3.11' => 'Win16',
'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
'Windows 98' => '(Windows 98)|(Win98)',
'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
'Windows 2003' => '(Windows NT 5.2)',
'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
'Windows ME' => 'Windows ME',
'Open BSD'=>'OpenBSD',
'Sun OS'=>'SunOS',
'Linux'=>'(Linux)|(X11)',
'Safari' => '(Safari)',
'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
'QNX'=>'QNX',
'BeOS'=>'BeOS',
'OS/2'=>'OS/2',
'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)'
);
foreach($oses as $os=>$pattern){
if (preg_match("/$pattern/i", $userAgent)) {
return $os; //
}
}
return 'Unknown';
}
if(function_exists("strptime") == false)
{
function strptime($sDate, $sFormat)
{
$aResult = array
(
'tm_sec' => 0,
'tm_min' => 0,
'tm_hour' => 0,
'tm_mday' => 1,
'tm_mon' => 0,
'tm_year' => 0,
'tm_wday' => 0,
'tm_yday' => 0,
'unparsed' => $sDate,
);
while($sFormat != "")
{
// ===== Search a %x element, Check the static string before the %x =====
$nIdxFound = strpos($sFormat, '%');
if($nIdxFound === false)
{
// There is no more format. Check the last static string.
$aResult['unparsed'] = ($sFormat == $sDate) ? "" : $sDate;
break;
}
// ===== Create the other value of the result array =====
$nParsedDateTimestamp = mktime($aResult['tm_hour'], $aResult['tm_min'], $aResult['tm_sec'],
$aResult['tm_mon'] + 1, $aResult['tm_mday'], $aResult['tm_year'] + 1900);
// Before PHP 5.1 return -1 when error
if(($nParsedDateTimestamp === false)
||($nParsedDateTimestamp === -1)) return false;
$aResult['tm_wday'] = (int) strftime("%w", $nParsedDateTimestamp); // Days since Sunday (0-6)
$aResult['tm_yday'] = (strftime("%j", $nParsedDateTimestamp) - 1); // Days since January 1 (0-365)
return $aResult;
} // END of function
} // END if(function_exists("strptime") == false)
}
//////////////////////////////// metaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
function meta($oldmeta,$koma){
global $con;
$oldmeta = mysqli_real_escape_string($con,$oldmeta);
$newmeta = str_replace(array(" "," و ","-","|","."," في "," على "," الى "," هل "," ان ","/","\\","\\r","\\n")," ",$oldmeta);
$newmeta = str_replace(" "," ",$newmeta);
$newmeta = str_replace(" "," ",$newmeta);
$newmeta = str_replace(" "," ",$newmeta);
$newmeta = str_replace("،",$koma,$newmeta);
$newmeta = str_replace(" ",$koma,$newmeta);
$newmeta = str_replace(",,",",",$newmeta);
$newmeta = str_replace(",,",",",$newmeta);
$newmeta_ar = explode($koma,$newmeta);
$newmeta_ar = array_unique($newmeta_ar);
$newmeta = implode($koma,$newmeta_ar);
return $newmeta;
}
//////////////////////////////// metaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
//////////////////////////////// page file
$pageFile = $_SERVER["PHP_SELF"];
$pageFile = explode("/",$pageFile);
$pageFile = $pageFile[(count($pageFile)-1)];
$pageFile = $pageFile."?".$_SERVER["QUERY_STRING"];
//////////////////////////////// page file
//////////////////////////////// page file
function safe($str)
{
return htmlspecialchars(addslashes(trim($str)));
}
//////////////////////////////// page file
//////////////////////////////// is new item
function isnew($max,$itmID){
$minID = $max - 50;
if($itmID >= $minID){
$isNEW = "
";
}else{
$isNEW = "";
}
return $isNEW;
}
//////////////////////////////// is new item
//////////////////////////////// get catlinks
function catlinks($cat_id,$sec_name,$totals,$filename = "video.php"){
$total_pgs = ceil($totals / 20);
if($total_pgs>10){$total_pgs = 10;}
for ($i=1; $i<$total_pgs; $i++) {
$link = htm($filename,$cat_id,$i);
$secname = GenWord($i,$sec_name);
$catlink[] = "$secname";
}
$catlinks = @implode(" - ",$catlink). "
";
return $catlinks;
}
//////////////////////////////// get catlinks
//////////////////////////////// crop text letters ...
function crop($start,$end,$text,$notags=0){
if(@stristr($text, $start)) {
$item_a = explode($start, $text);
if(!$item_a[1]){$item_a[1] = $text;}
}else{
$item_a[1] = $text;
}
if(stristr($text, $end)) {
$item_b = explode($end, $item_a[1]);
if($item_b[0]){
$get = $item_b[0];
}else{
$get = $item_a[1];
}
}else{
$get = $item_a[1];
}
if($notags == "notags"){
$get = notags($get);
}
return $get;
}
//////////////////////////////// crop text letters ...
//////////////////////////////// crop text WORDS ONLY ...
function wordCut($text, $limit, $msg){
if (strlen($text) > $limit){
$txt1 = wordwrap($text, $limit, '[cut]');
$txt2 = explode('[cut]', $txt1);
$ourTxt = $txt2[0];
$finalTxt = $ourTxt.$msg;
}else{
$finalTxt = $text;
}
return $finalTxt;
}
//////////////////////////////// crop text WORDS ONLY ...
//////////////////////////////// remove tags in text words ...
function notags($str) {
$strs=explode('<',$str);
$res=$strs[0];
for($i=1;$i'))
$res = $res.'<'.$strs[$i];
else
$res = $res.'<'.$strs[$i];
}
$res = strip_tags($res);
$res = str_replace(array("<","<",">"),"",$res);
// $reso=$strs[1];
// $strs2=explode('>',$reso);
// $res2=$strs2[1];
$res = str_replace("'","'" ,$res);
return $res;
}
//////////////////////////////// remove tags in text words ...
/////////////////////////////////////// get SELECT cat_name from cat Or SELECT * from cat ;)
/// return $r; << array ;) ////////////////////////////////////////////////////
function SQLGET( $options,$fld_name = "cat_name", $tbl_name = "cat",$where = "",$limit = "",$order ="",$group=""){
global $con;
$where = trim($where);
$fld_id = $tbl_name."_id";
$wrid = "";
if(intval($options)){
$wrid = " $fld_id='$options' ";
}else{
$IDSar = get_arr_IDS_from_value($options);
if (!empty($IDSar) && count($IDSar) > 1) {
$wrid = " $fld_id IN (".implode(",",$IDSar).") ";
}
}
$options_arr = [];
if($options){
$options_arr = explode(",",$options);
}
$wridsql="";
if($wrid){
$wridsql = "and $wrid";
}
$wheresql = "";
$limitsql = "";
$groupsql = "";
$ordersql = "";
if($where){$wheresql = " and ".$where;}
if($limit){$limitsql = " limit ".$limit;}
if($group){$groupsql = " GROUP BY ".$group;}
if($order){$ordersql = " order by ".$order;}
$where = "$wridsql $wheresql";
$where = preg_replace('/^and\s+/i', '', trim($where));
if(trim($where)){
$sqlWhere = "where $where";
}
$sqlFinal = " $sqlWhere $groupsql $ordersql $limitsql";
//$sqlline = preg_replace('/\s+where$/i', '', trim($sqlline));
$sqlline = "SELECT $fld_name FROM $tbl_name $sqlFinal ";
$sqlline = preg_replace('/\s+/', ' ', $sqlline);
//if($_SESSION["logged_user"]["user_id"]==2){
//echo $sqlline;
//}
//echo $sqlline;
//return $sqlline;
// break;
//$folder_name = date("Y_m_d_H");
$folder_name = date("Y_m");
$folder_name = $folder_name;
//$folder_path = "/var/www/vhosts/meaningnames.net/jsons/SQLGET/$folder_name/$tbl_name/";
$folder_path = "/var/www/vhosts/meaningnames.net/jsons/SQLGET/$folder_name/$tbl_name/";
if (!is_dir($folder_path)) {mkdir($folder_path, 0777, true);}
$file_name = md5($sqlline).".json";
$file_path = $folder_path . $file_name;
if (
(
file_exists($file_path)
and(in_array("cache",$options_arr))
)
and(
($_SESSION["stopCache"] < (time()-(60)))
OR
(!$_SESSION["stopCache"])
)
) {
$json_data = file_get_contents($file_path);
$data = json_decode($json_data, true);
$arraysql = $data["data"];
//$arraysql = [];
$_SESSION["lastCacheType"] = "old";
$_SESSION["lastCacheTime"] = $data["date"];
}else{
$query = mysqli_query($con,$sqlline);
if($query){
$arraysql = array();
while ($r = mysqli_fetch_assoc($query)){
$fld_id_v = $r[$fld_id];
if(in_array("key_id",$options_arr)){
$arraysql[$fld_id_v] = $r;
}elseif(in_array("ids",$options_arr)){
$arraysql[] = $r[$fld_name];
}else{
$arraysql[] = $r;
}
}
mysqli_free_result($query);
}
$data = array(
"sql" => "$sqlline"
,"data" => $arraysql
,"date" => time()
);
$json_data = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
file_put_contents($file_path, $json_data);
$_SESSION["lastCacheType"] = "new";
}
$_SESSION["lastCache"] = $file_path;
return $arraysql;
}
/// return $r; << array ;) ////////////////////////////////////////////////////
/////////////////////////////////////// get SELECT cat_name from cat Or SELECT * from cat ;)
function SQLGET1($id, $fld_name = "cat_name", $tbl_name = "cat",$options=[]) {
global $con;
$wr = $tbl_name . "_id='$id'";
$sql = "SELECT $fld_name FROM $tbl_name WHERE $wr";
//$folder_name = date("Y_m_d_H");
$folder_name = date("Y_m");
$folder_path = "/var/www/vhosts/meaningnames.net/jsons/SQLGET1/$folder_name/$tbl_name/";
if (!is_dir($folder_path)) {mkdir($folder_path, 0777, true);}
$file_name = $id."-".md5($sql).".json";
$file_path = $folder_path . $file_name;
if (
(file_exists($file_path))
and($options["cache"] == true)
and(
($_SESSION["stopCache"] < (time()-(60)))
OR
(!$_SESSION["stopCache"])
)
) {
$json_data = file_get_contents($file_path);
$data = json_decode($json_data, true);
$row = $data["data"];
//$row = [];
}else{
$result = mysqli_query($con, $sql);
if (!$result) {
// Handle query error here
return false;
}
$row = mysqli_fetch_assoc($result);
mysqli_free_result($result);
$data = array(
"sql" => "$sql"
,"data" => $row
,"date" => time()
);
$json_data = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
file_put_contents($file_path, $json_data);
}
if ($fld_name == "*") {
return $row;
} else {
return $row;
//return isset($row[$fld_name]) ? $row[$fld_name] : null;
}
}
///////////////////////////////// Get value fald from table .........
/////////////////////////////////////// get SELECT cat_name from cat Or SELECT * from cat ;)
/// return $r; << array ;) ////////////////////////////////////////////////////
function SQLGET111( $id,$fld_name = "cat_name", $tbl_name = "cat",$where = "",$limit = "",$order =""){
global $con;
$fld_id = $tbl_name."_id";
if(intval($id)){$wrid = " $fld_id='$id' ";}else{$wrid = " $fld_id !=0 ";}
if($where){$wheresql = " and ".$where;}
if($limit){$limitsql = " limit ".$limit;}
if($order){$ordersql = " order by ".$order;}
$sqlline = "SELECT $fld_name FROM $tbl_name where $fld_id !=0 and $wrid $wheresql $ordersql $limitsql";
// return $sqlline;
// break;
$query = mysqli_query($con,$sqlline);
if($query){
$arraysql = array();
while ($r = mysqli_fetch_array($query)){
$arraysql[] = $r;
}
@mysqli_free_result($query);
}
return $arraysql;
}
/// return $r; << array ;) ////////////////////////////////////////////////////
/////////////////////////////////////// get SELECT cat_name from cat Or SELECT * from cat ;)
///////////////////////////////// Get value fald from table .........
function SQLGET1111( $id,$fld_name = "cat_name", $tbl_name = "cat"){
global $con;
$wr = $tbl_name."_id='$id'";
$r = mysqli_fetch_array(mysqli_query ($con,"SELECT $fld_name FROM $tbl_name where $wr"));
if($fld_name == "*"){
return $r;
}else{
return $r;
}
}
///////////////////////////////// Get value fald from table .........
///////////////////////////////// Get Arabic Date .........
function datename($date = ""){
$nowdate = date ("Y/n/j");
$arrays = array("/","\\",".",",","-");
if(!$date){
$date = $nowdate;
}
$date = str_replace($arrays,"-",$date);
$datear = @explode("-",$date);
$day = $datear[0];
$month = $datear[1];
if(strlen($datear[2]) ==4 ){$day = $datear[0]; $year = $datear[2];}else{$day = $datear[2]; $year = $datear[0];}
$timest= @gmmktime(0, 0, 0, $month, $day, $year);
$datea = @adate($format="D , j M Yم",$timest);
if($datea){
return $datea;
}else{return $date;}
}
///////////////////////////////// Get Arabic Date .........
function get_query_from_value($value,$name)
{
if(!is_int($value)){
$newValueNUM = get_arr_IDS_from_value($value);
if(is_array($newValueNUM)){
$newValueSQL = implode(" OR $name = ",$newValueNUM);
$newValueSQL = "( $name = ".$newValueSQL." )";
$newValue = implode(",",$newValueNUM);
$newValue =$newValueSQL;
}else{
$newValue = "( $name = $value )";
}
}else{
$newValue = "( $name = $value )";
}
return $newValue;
}
function get_arr_IDS_from_value($value)
{
if(intval($value)){
$newValueNUM[] = $value;
}else{
$newValue = get_numeric($value);
$newValuear = explode(",",$newValue);
$newValue = array();
foreach ($newValuear as $vl){
if($vl){
$newValueNUM[] = $vl;
}
}
}
return $newValueNUM;
}
///////////// get_numeric ///////////
///////////// get_numeric ///////////
function get_numeric($val) {
if (is_numeric($val)) {
return $val + 0;
}else{
$number = preg_replace("/[^0-9]/", ',', $val);
return $number;
}
}
function str_replacer($_string, $_replacer = ' ...') {
$_lengthall = strlen($_string);
$_lengthhalf = $_lengthall / 2;
$_length = intval($_lengthhalf + ($_lengthhalf / 2));
// لو النص قصير، نرجعه كما هو
if (strlen($_string) <= $_length) {
return $_string;
}
// إيجاد آخر مسافة قبل الطول المحدد
$_last_white_space_pos = strripos(substr($_string, 0, $_length), ' ');
if ($_last_white_space_pos === false) {
$_last_white_space_pos = $_length; // fallback لو مفيش مسافات
}
// اجعل الفاصل ثابت وواضح
$separator = '||||||||';
$first_part = substr($_string, 0, $_last_white_space_pos);
$second_part = substr($_string, $_last_white_space_pos);
// ارجع المصفوفة جاهزة مباشرة بدون تعقيد explode
return array($first_part, $second_part);
}
///////////// get_ name of ut type ///////////
function get_switch($val = array()) {
if (count($val)>1) {
if($val[ut_cat_courses] == 0){$name="5eer";}
if($val[ut_cat_courses] == 1){$name="course";}
if($val[ut_cat_natg] == 1){$name="natg";}
if($val[ut_cat_doc] == 1){$name="doc";}
if($val[ut_cat_nlp] == 1){$name="nlp";}
if($val[ut_cat_hmade] == 1){$name="hmade";}
}else{
$name = "0";
}
return $name;
}
function get_notes_info($c){
$Cinfo = array();
switch ($c){
case "hkm":
$Cinfo[PAGEname] = "حكمة قصيرة";
$Cinfo[PAGEurl] = "notes/ShortAphorism/$id";
$Cinfo[PAGEdesc] = "| حكم قصيرة | خذو الحكمة من أفواه الحكماء ";
$Cinfo[PAGEcatname] = "حكم قصيرة";
$Cinfo[PAGEcaturl] = "notes/ShortAphorism/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/hkm.png";
break;
case "ngah":
$Cinfo[PAGEname] = "مقولات النجاح";
$Cinfo[PAGEurl] = "notes/SuccessSayings/$id";
$Cinfo[PAGEdesc] = "مقولات وأقوال مأثورة في النجاح والسعي الى النجاح";
$Cinfo[PAGEcatname] = "قالوا في النجاح";
$Cinfo[PAGEcaturl] = "notes/SuccessSayings/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/ngah.png";
break;
case "hal":
$Cinfo[PAGEname] = "معلومة";
$Cinfo[PAGEurl] = "notes/DidYouKnow/$id";
$Cinfo[PAGEdesc] = " معلومات قصيرة ثقافه سريعة";
$Cinfo[PAGEcatname] = "هل تعلم أن";
$Cinfo[PAGEcaturl] = "notes/DidYouKnow/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/DidYouKnow.png";
break;
case "lifelearn":
$Cinfo[PAGEname] = "علمتني الحياه";
$Cinfo[PAGEurl] = "notes/LifeTaughtUs/$id";
$Cinfo[PAGEdesc] = "علمتنا الحياه بتجاربها في مدرسة الحياة";
$Cinfo[PAGEcatname] = "هكذا علمتني الحياه";
$Cinfo[PAGEcaturl] = "notes/LifeTaughtUs/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/lifelearn.png";
break;
case "creation":
$Cinfo[PAGEname] = "مخترع";
$Cinfo[PAGEurl] = "notes/inventors/$id";
$Cinfo[PAGEdesc] = "اهم الاختراعات ومخترعيها في التاريخ";
$Cinfo[PAGEcatname] = "مخترعون واختراعات";
$Cinfo[PAGEcaturl] = "notes/inventors/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/creation.png";
break;
case "awael":
$Cinfo[PAGEname] = "الأوائل";
$Cinfo[PAGEurl] = "notes/TopFirst/$id";
$Cinfo[PAGEdesc] = "الأوائل في تاريخ العالم";
$Cinfo[PAGEcatname] = "الأوائل";
$Cinfo[PAGEcaturl] = "notes/TopFirst/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/awael.png";
break;
case "daily":
$Cinfo[PAGEname] = "حدث اليوم";
$Cinfo[PAGEurl] = "notes/ThisTodayIn/$id";
$Cinfo[PAGEdesc] = "أهم الأحداث التاريخية في العالم ";
$Cinfo[PAGEcatname] = "حدث في مثل هذا اليوم";
$Cinfo[PAGEcaturl] = "notes/ThisTodayIn/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/daily.png";
break;
case "tips":
$Cinfo[PAGEname] = "نصيحه نفسية";
$Cinfo[PAGEurl] = "notes/PsychologicalTips/$id";
$Cinfo[PAGEdesc] = "أفضل النصائح والمقولات المأثورة التي تخلصك من ضغوط الحياة";
$Cinfo[PAGEcatname] = "نصائح نفسية";
$Cinfo[PAGEcaturl] = "notes/PsychologicalTips/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/tips.png";
break;
case "hadith":
$Cinfo[PAGEname] = "حديث صحيح";
$Cinfo[PAGEurl] = "notes/hadith/$id";
$Cinfo[PAGEdesc] = "مجموعة من الأحاديث الصحيحه عن النبي صلى الله عليه وسلم";
$Cinfo[PAGEcatname] = "أحاديث صحيحه";
$Cinfo[PAGEcaturl] = "notes/hadith/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/hadith.png";
break;
default:
$Cinfo[PAGEname] = "النوتة اليومية";
$Cinfo[PAGEurl] = "notes/";
$Cinfo[PAGEdesc] = "مجموعة من المقالات والاحاديث و الحكم المأثورة والمعلومات القيّمة";
$Cinfo[PAGEcatname] = "حكمة ، مقولة ، حديث";
$Cinfo[PAGEcaturl] = "notes/";
$Cinfo[PAGEimg] = "http://www.elebda3.com/img/NOTEDAILY.png";
}
return $Cinfo;
}
function str_split_php4_utf8($str) {
// place each character of the string into and array
$split=1;
$array = array();
for ( $i=0; $i < strlen( $str ); ){
$value = ord($str[$i]);
if($value > 127){
if($value >= 192 && $value <= 223)
$split=2;
elseif($value >= 224 && $value <= 239)
$split=3;
elseif($value >= 240 && $value <= 247)
$split=4;
}else{
$split=1;
}
$key = NULL;
for ( $j = 0; $j < $split; $j++, $i++ ) {
$key .= $str[$i];
}
array_push( $array, $key );
}
return $array;
}
function getWhereLikeFromString($c,$field = "search_name",$type = "letter"){
if(stristr($c, ' ')){
$wordsar = explode(" ",$c);
//print_r($wordsar);
$WORDS = array();
$likedisar = array();
foreach($wordsar as $WORD){
if(strlen($WORD) > 3){
$WORDS[] = "$WORD";
if($type == "letter"){
$littersC = str_split_php4_utf8($WORD);
$likedis = implode("%",$littersC);
$likedisar[] = "($field LIKE '%$likedis%')";
}else{
$likedisar[] = "($field LIKE '%$WORD%')";
}
}
}
$whereLIKE = implode(" or ",$likedisar);
//print_r($likedisar);
}else{
if($type == "letter"){
//echo "
$c
";
$littersC = str_split_php4_utf8($c);
//print_r($littersC);
$likedis = implode("%",$littersC);
}else{
$likedis = $c;
}
$whereLIKE = "$field LIKE '%$likedis%'";
}
return $whereLIKE;
}
function tagGetLinks($tags,$searchfor){
$searcharr = explode("_",$searchfor);
//print_r($searcharr);
$numS = array();
for($i=1;$i<30;$i++){
//'@^(?:http://)?([^/]+)@i'
//preg_match('@(?:[sub])?([sub]+)@i',$tags , $matches);
preg_match('/'.$searcharr[0].'([0-9]+)'.$searcharr[1].'/i ',$tags , $matches);
//print_r($matches);
$tags = str_replace("$searcharr[0]".$matches[1]."$searcharr[1]","",$tags);
//echo "\n
tags: $tags
\n";
$number = $matches[1];
//echo "$number
";
if($number>0){$numS[$searchfor][]=$number;}
if(!$matches[1]){ break;}
}
return $numS[$searchfor];
}
function GetDomain($url)
{
$nowww = preg_replace('/^www\./', '', $url);
$domain = parse_url($nowww);
if(!empty($domain["host"]))
{
return $domain["host"];
} else
{
return $domain["path"];
}
}
function Getphpself($url)
{
$temp = explode("/",$url);
$temp = end($temp);
$temp = str_replace("&ajaxtrue=1","",$temp);
return $temp;
}
//youtubeidyoutubeidyoutubeidyoutubeidyoutubeidyoutubeidyoutubeidyoutubeidyoutubeidyoutubeid
function youtubeid($url) {
$len = strlen($url);
if($len > 14){
$url = str_replace('ut.be','youtube.com',$url);
if (preg_match('%youtube\\.com/(.+)%', $url, $match)) {
$match = $match[1];
if(stristr($match, "&v=")){
$match = explode("&v=",$match);
$match = $match[1];
}
$replace = array("watch?v=", "v/", "vi/");
$match = str_replace($replace, "", $match);
}
if(stristr($match, "&")){
$match = explode("&",$match);
$match = $match[0];
}
return $match;
}else{
return $url;
}
}
//function one - get entire domain
function fulldomain($domainb) {
$bits = explode('/', $domainb);
if ($bits[0]=='http:' || $bits[0]=='https:')
{
return $bits[0].'//'.$bits[2].'/';
} else {
return 'http://'.$bits[0].'/';
}
unset($bits);
}
function get_file_extension($file_name)
{
return substr(strrchr($file_name,'.'),1);
}
function get_file_name($file_name)
{
return substr(strrchr($file_name,'/'),1);
}
function file_extension($filename)
{
$path_info = pathinfo($filename);
return $path_info['extension'];
}
function str_spliter($str) {
// place each character of the string into and array
$split=1;
$array = array();
for ( $i=0; $i < strlen( $str ); ){
$value = ord($str[$i]);
if($value > 127){
if($value >= 192 && $value <= 223)
$split=2;
elseif($value >= 224 && $value <= 239)
$split=3;
elseif($value >= 240 && $value <= 247)
$split=4;
}else{
$split=1;
}
$key = NULL;
for ( $j = 0; $j < $split; $j++, $i++ ) {
$key .= $str[$i];
}
array_push( $array, $key );
}
return $array;
}
function dash($string){$string = str_replace("-"," ",$string);return $string;}
function dashc($string){$string = str_replace(" ","-",$string);return $string;}
function noTashkel($string){
$string = str_replace(array("َ","ً","ُ","ٌ","ّ","ْ","ِ"),"",$string);
return $string;}
function multiSelectGNR($name ="",$cat){
if(stristr($name,"_")){
$namear = explode("_",$name);
$count = count($namear);
return $namear[$count-2].$cat.$namear[$count-1];
}else{
return $name.$cat.$name;
}
}
function hits($tb,$id,$fld="hits"){
global $con;
$FILD = $tb."_".$fld;
$FILDid = $tb."_id";
$visets = "update $tb set $FILD=$FILD+1 where $FILDid='$id'";
$visetsr = mysqli_query ($con,$visets);
if($visetsr){$ret="";}else{$ret="error hits";}
return $ret;
}
function hits_month($tb,$id,$month,$fld="hits"){
global $con;
$now_month = date("n");
$FILD = $tb."_".$fld;
$FILDid = $tb."_id";
$FILDmonth = $tb."_month";
$FILDmonthhits = $tb."_month_".$fld;
if($now_month == $month){
$visets = "update $tb set $FILD=$FILD+1,$FILDmonthhits=$FILDmonthhits+1 where $FILDid='$id'";
}else{
$visets = "update $tb set $FILD=$FILD+1,$FILDmonthhits='0',$FILDmonth ='$now_month' where $FILDid='$id'";
}
$visetsr = mysqli_query ($con,$visets);
if($visetsr){$ret="done";}else{$ret="error hits";}
return $ret;
}
function get_hashtag($SEC_NAME){
$SEC_NAME = "#". stripslashes($SEC_NAME);
$SEC_NAME = str_replace(array("\"","/","'","-","_",",","،",")","(",":",".")," ",$SEC_NAME);
$SEC_NAME = str_replace(" "," ",$SEC_NAME);
$SEC_NAME = str_replace(" "," ",$SEC_NAME);
$SEC_NAME = str_replace(" ","_",$SEC_NAME);
$SEC_NAME = str_replace("__","_",$SEC_NAME);
$SEC_NAME = str_replace("__","_",$SEC_NAME);
$SEC_NAME = str_replace("__","_",$SEC_NAME);
$SEC_NAME = str_replace("#_","#",$SEC_NAME);
$SEC_NAME = trim($SEC_NAME,"_");
return $SEC_NAME." ";
}
?>
Fatal error: Uncaught Error: Call to undefined function GetDomain() in /var/www/vhosts/meaningnames.net/httpdocs/index.php:12
Stack trace:
#0 {main}
thrown in /var/www/vhosts/meaningnames.net/httpdocs/index.php on line 12