Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* * ------------------------------------------------------ * Drop - Advanced ..

Decoded Output download

<?php 
/* 
 * ------------------------------------------------------ 
 *  Drop - Advanced PHP  
 * ------------------------------------------------------ 
 *  Official Website : https:// 
 *  Version          : 7.6.0.0 
 *  Author           : Drop Team 
 *  Release Date     : 2024-09-15 
 * ------------------------------------------------------ 
 *   2024 Drop.Net - All Rights Reserved. 
 *  This file is part of the Drop software package. 
 */ 
 
function in_array_r($item, $array) 
{ 
	$item = preg_quote($item); 
	return preg_match('/"' . $item . '"/i', json_encode($array)); 
} 
 
function codeToCountryName($code) 
{ 
	$code = strtoupper($code); 
	$countryList = ['AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas the', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island (Bouvetoya)', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory (Chagos Archipelago)', 'VG' => 'British Virgin Islands', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros the', 'CD' => 'Congo', 'CG' => 'Congo the', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote d\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FO' => 'Faroe Islands', 'FK' => 'Falkland Islands (Malvinas)', 'FJ' => 'Fiji the Fiji Islands', 'FI' => 'Finland', 'FR' => 'France, French Republic', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia the', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GG' => 'Guernsey', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and McDonald Islands', 'VA' => 'Holy See (Vatican City State)', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IM' => 'Isle of Man', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JE' => 'Jersey', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyz Republic', 'LA' => 'Lao', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'AN' => 'Netherlands Antilles', 'NL' => 'Netherlands the', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => 'Palestinian Territory', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Islands', 'PL' => 'Poland', 'PT' => 'Portugal, Portuguese Republic', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'BL' => 'Saint Barthelemy', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'MF' => 'Saint Martin', 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia (Slovak Republic)', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia, Somali Republic', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard & Jan Mayen Islands', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland, Swiss Confederation', 'SY' => 'Syrian Arab Republic', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TL' => 'Timor-Leste', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'United Kingdom', 'US' => 'United States of America', 'UM' => 'United States Minor Outlying Islands', 'VI' => 'United States Virgin Islands', 'UY' => 'Uruguay, Eastern Republic of', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'WF' => 'Wallis and Futuna', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe']; 
	return (isset($countryList[$code]) ? $countryList[$code] : false); 
} 
 
function CountryNametoCode($name) 
{ 
	$countryList = ['AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas the', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island (Bouvetoya)', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory (Chagos Archipelago)', 'VG' => 'British Virgin Islands', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros the', 'CD' => 'Congo', 'CG' => 'Congo the', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote d\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FO' => 'Faroe Islands', 'FK' => 'Falkland Islands (Malvinas)', 'FJ' => 'Fiji the Fiji Islands', 'FI' => 'Finland', 'FR' => 'France, French Republic', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia the', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GG' => 'Guernsey', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and McDonald Islands', 'VA' => 'Holy See (Vatican City State)', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IM' => 'Isle of Man', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JE' => 'Jersey', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyz Republic', 'LA' => 'Lao', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'AN' => 'Netherlands Antilles', 'NL' => 'Netherlands the', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => 'Palestinian Territory', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Islands', 'PL' => 'Poland', 'PT' => 'Portugal, Portuguese Republic', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'BL' => 'Saint Barthelemy', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'MF' => 'Saint Martin', 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia (Slovak Republic)', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia, Somali Republic', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard & Jan Mayen Islands', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland, Swiss Confederation', 'SY' => 'Syrian Arab Republic', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TL' => 'Timor-Leste', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'United Kingdom', 'US' => 'United States of America', 'UM' => 'United States Minor Outlying Islands', 'VI' => 'United States Virgin Islands', 'UY' => 'Uruguay, Eastern Republic of', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'WF' => 'Wallis and Futuna', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe']; 
 
	if ($x = array_search(strtolower($name), array_map('strtolower', $countryList))) { 
		return $x; 
	} 
	else { 
		return 'NG'; 
	} 
} 
 
function random_text($count, $rm_similar = false) 
{ 
	$chars = array_flip(array_merge(range(0, 9), range('A', 'Z'))); 
 
	if ($rm_similar) { 
		unset($chars[0]); 
		unset($chars[1]); 
		unset($chars[2]); 
		unset($chars[5]); 
		unset($chars[8]); 
		unset($chars['B']); 
		unset($chars['I']); 
		unset($chars['O']); 
		unset($chars['Q']); 
		unset($chars['S']); 
		unset($chars['U']); 
		unset($chars['V']); 
		unset($chars['Z']); 
	} 
 
	$text = ''; 
 
	for ($i = 0; $i < $count; ++$i) { 
		$text .= array_rand($chars); 
	} 
 
	return $text; 
} 
 
function isValidDate($date, $format = 'Y-m-d') 
{ 
	return $date == date($format, strtotime($date)); 
} 
 
function isValidTimezoneId($timezoneId) 
{ 
	try { 
		new DateTimeZone($timezoneId); 
	} 
	catch (PHPMailer\PHPMailer\Exception $e) { 
		return false; 
	} 
 
	return true; 
} 
 
function formatBytes($bytes, $precision = 2) 
{ 
	if (pow(1024, 3) < $bytes) { 
		return round($bytes / pow(1024, 3), $precision) . 'GB'; 
	} 
	else if (pow(1024, 2) < $bytes) { 
		return round($bytes / pow(1024, 2), $precision) . 'MB'; 
	} 
	else if (1024 < $bytes) { 
		return round($bytes / 1024, $precision) . 'KB'; 
	} 
	else { 
		return $bytes . 'B'; 
	} 
} 
 
function recursive_array_search($needle, $haystack) 
{ 
	foreach ($haystack as $key => $value) { 
		$current_key = $key; 
		if (($needle === $value) || is_array($value) && recursive_array_search($needle, $value) !== false) { 
			return $current_key; 
		} 
	} 
 
	return false; 
} 
 
function seo_process($values) 
{ 
	if (!is_array($values)) { 
		return NULL; 
	} 
 
	$GLOBALS['admin_template']['seo']['title'] = (isset($values['title']) ? $values['title'] : NULL); 
	$GLOBALS['admin_template']['seo']['author'] = (isset($values['author']) ? $values['author'] : NULL); 
	$GLOBALS['admin_template']['seo']['description'] = (isset($values['description']) ? $values['description'] : NULL); 
	$GLOBALS['admin_template']['seo']['type'] = (isset($values['type']) ? $values['type'] : NULL); 
	$GLOBALS['admin_template']['seo']['url'] = (isset($values['url']) ? $values['url'] : NULL); 
	$GLOBALS['admin_template']['seo']['category'] = (isset($values['category']) ? $values['category'] : NULL); 
	$GLOBALS['admin_template']['seo']['date_created'] = (isset($values['date_created']) ? $values['date_created'] : NULL); 
	$GLOBALS['admin_template']['seo']['date_modified'] = (isset($values['date_modified']) ? $values['date_modified'] : NULL); 
	$GLOBALS['admin_template']['seo']['image'] = (isset($values['image']) ? $values['image'] : NULL); 
	$GLOBALS['admin_template']['seo']['robot_not_crawl'] = (isset($values['nofollow']) ? 1 : NULL); 
} 
 
function crypto_string($type = 'alnum', $length = 13) 
{ 
	switch ($type) { 
	case 'alnum': 
		$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
		break; 
	case 'alpha': 
		$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
		break; 
	case 'hexdec': 
		$pool = '0123456789abcdef'; 
		break; 
	case 'numeric': 
		$pool = '0123456789'; 
		break; 
	case 'nozero': 
		$pool = '123456789'; 
		break; 
	case 'distinct': 
		$pool = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
		break; 
	case 'distinct2': 
		$pool = '2345679ACDEFHJKLMNPRSTUVWXYZ'; 
		break; 
	default: 
		$pool = (string) $type; 
		break; 
	} 
	$crypto_rand_secure = function($min, $max) { 
		$rnd = 0; 
		$range = $max - $min; 
 
		if ($range < 0) { 
			return $min; 
		} 
 
		$log = log($range, 2); 
		$bytes = (int) ($log / 8) + 1; 
		$bits = (int) $log + 1; 
		$filter = (int) (1 << $bits) - 1; 
 
		do { 
			$rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes))); 
			$rnd = $rnd & $filter; 
		} while ($range <= $rnd); 
 
		return $min + $rnd; 
	}; 
	$token = ''; 
	$max = strlen($pool); 
 
	for ($i = 0; $i < $length; ++$i) { 
		$token .= $pool[$crypto_rand_secure(0, $max)]; 
	} 
 
	return $token; 
} 
 
function mask_email($email, $mask_char = '*', $percent = 50) 
{ 
	if (empty($email)) { 
		return ''; 
	} 
 
	list($user, $domain) = preg_split('/@/', $email); 
	$len = strlen($user); 
	$mask_count = floor(($len * $percent) / 100); 
	$offset = floor(($len - $mask_count) / 2); 
	$masked = substr($user, 0, $offset) . str_repeat($mask_char, $mask_count) . substr($user, $mask_count + $offset); 
	return $masked . '@' . $domain; 
} 
 
function mask_string($string, $mask_char = '*', $percent = 40) 
{ 
	if (empty($string)) { 
		return ''; 
	} 
 
	$len = strlen($string); 
	$mask_count = floor(($len * $percent) / 100); 
	$offset = floor(($len - $mask_count) / 2); 
	$masked = substr($string, 0, $offset) . str_repeat($mask_char, $mask_count) . substr($string, $mask_count + $offset); 
	return $masked; 
} 
 
function encodeStr($string, $key = 'projectgics') 
{ 
	$key = sha1($key); 
	$j = 0; 
	$strLen = strlen($string); 
	$keyLen = strlen($key); 
	$hash = ''; 
 
	for ($i = 0; $i < $strLen; ++$i) { 
		$ordStr = ord(substr($string, $i, 1)); 
 
		if ($j == $keyLen) { 
			$j = 0; 
		} 
 
		$ordKey = ord(substr($key, $j, 1)); 
		++$j; 
		$hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36)); 
	} 
 
	return $hash; 
} 
 
function decodeStr($string, $key = 'projectgics') 
{ 
	$key = sha1($key); 
	$j = 0; 
	$strLen = strlen($string); 
	$keyLen = strlen($key); 
	$hash = ''; 
	$i = 0; 
 
	while ($i < $strLen) { 
		$ordStr = hexdec(base_convert(strrev(substr($string, $i, 2)), 36, 16)); 
 
		if ($j == $keyLen) { 
			$j = 0; 
		} 
 
		$ordKey = ord(substr($key, $j, 1)); 
		++$j; 
		$hash .= chr($ordStr - $ordKey); 
		$i += 2; 
	} 
 
	return $hash; 
} 
 
function sendRealTimeNotification($target, $data) 
{ 
	global $settings_data2; 
 
	if (empty($settings_data2['firebase-rtdb-url'])) { 
		return ['error' => 1]; 
	} 
 
	$fb_database_url = (substr($settings_data2['firebase-rtdb-url'], -1, 1) == '/' ? $settings_data2['firebase-rtdb-url'] : $settings_data2['firebase-rtdb-url'] . '/'); 
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json')->withDatabaseUri($fb_database_url); 
	$user_type = substr($target, 0, 4); 
 
	if ($user_type == 'drvr') { 
		$db_node = 'Drivers'; 
	} 
	else if ($user_type == 'ridr') { 
		$db_node = 'Riders'; 
	} 
	else { 
		return ['error' => 1]; 
	} 
 
	try { 
		$db = $factory_fbsdk->createDatabase(); 
		$db->getReference($db_node . '/' . $target)->set([ 
			'notf' => ['msg' => $data, 'msg_t' => time()] 
		]); 
		return ['success' => 1]; 
	} 
	catch (Throwable $e) { 
		return ['error' => 1]; 
	} 
} 
 
function floattocurrency($amount) 
{ 
	$amount = (float) $amount; 
	return number_format($amount, 2); 
} 
 
function distance($lat1, $lon1, $lat2, $lon2) 
{ 
	$lat1 = (float) $lat1; 
	$lon1 = (float) $lon1; 
	$lat2 = (float) $lat2; 
	$lon2 = (float) $lon2; 
	$pi80 = M_PI / 180; 
	$lat1 *= $pi80; 
	$lon1 *= $pi80; 
	$lat2 *= $pi80; 
	$lon2 *= $pi80; 
	$r = 6372.797; 
	$dlat = $lat2 - $lat1; 
	$dlon = $lon2 - $lon1; 
	$a = (sin($dlat / 2) * sin($dlat / 2)) + (sin($dlon / 2) * (sin($dlon / 2) * (cos($lat1) * cos($lat2)))); 
	$c = atan2(sqrt($a), sqrt(1 - $a)) * 2; 
	$km = $r * $c; 
	return $km; 
} 
 
function sendMail($to = '', $subject = '', $message = '', $smtp_test = []) 
{ 
	$mail = new PHPMailer\PHPMailer\PHPMailer(true); 
 
	try { 
		if (empty($smtp_test)) { 
			if (!SMTP_HOST || !SMTP_USERNAME || !SMTP_PWD || !MAIL_SENDER) { 
				$data = ['response' => 0, 'message' => 'Incorrect email settings']; 
				return $data; 
			} 
 
			$smtp_hostname = SMTP_HOST; 
			$smtp_username = SMTP_USERNAME; 
			$smtp_password = SMTP_PWD; 
			$smtp_mail_sender = MAIL_SENDER; 
		} 
		else { 
			$smtp_hostname = $smtp_test['host']; 
			$smtp_username = $smtp_test['username']; 
			$smtp_password = $smtp_test['password']; 
			$smtp_mail_sender = $smtp_test['username']; 
		} 
 
		$mail->isSMTP(); 
		$mail->Host = $smtp_hostname; 
		$mail->SMTPAuth = true; 
		$mail->Username = $smtp_username; 
		$mail->Password = $smtp_password; 
		$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS; 
		$mail->Port = 465; 
		$mail->setFrom($smtp_mail_sender, WEBSITE_NAME); 
		$mail->addAddress($to); 
		$mail->isHTML(true); 
		$mail->Subject = $subject; 
		$mail->Body = $message; 
		$mail->send(); 
		$data = ['response' => 1, 'message' => 'Message has been sent']; 
		return $data; 
	} 
	catch (PHPMailer\PHPMailer\Exception $e) { 
		$data = ['response' => 0, 'message' => $mail->ErrorInfo]; 
		return $data; 
	} 
} 
 
function __($phrase, $options = [], $lang = '') 
{ 
	if (!empty($lang)) { 
		$lang_options = explode('|', $lang); 
 
		if (is_array($lang_options)) { 
			if ($lang_options[0] == 'r') { 
				include FILES_FOLDER . ('/lang/rider/' . $lang_options[1] . '.php'); 
			} 
			else if ($lang_options[0] == 'd') { 
				include FILES_FOLDER . ('/lang/driver/' . $lang_options[1] . '.php'); 
			} 
			else { 
				global $lang_phrases; 
			} 
		} 
		else { 
			global $lang_phrases; 
		} 
	} 
	else { 
		global $lang_phrases; 
	} 
	if (!(isset($lang_phrases) && isset($lang_phrases[$phrase]))) { 
		return $phrase; 
	} 
 
	$translation = $lang_phrases[$phrase]; 
 
	if (!empty($translation)) { 
		$pattern = '/\\{\\-\\-\\-[0-9]\\}/'; 
 
		if (preg_match($pattern, $translation)) { 
			preg_match_all($pattern, $translation, $matches); 
 
			if (count($matches[0]) != count($options)) { 
				return $translation; 
			} 
 
			foreach ($matches[0] as $match) { 
				$match_pos = (int) substr($match, 4, 1); 
 
				if (empty($options[$match_pos - 1])) { 
					continue; 
				} 
 
				$translation = str_replace($match, $options[$match_pos - 1], $translation); 
			} 
 
			return $translation; 
		} 
 
		return $translation; 
	} 
 
	return $phrase; 
} 
 
function ___($phrase, $options = [], $lang = 'en') 
{ 
	global $dict_phrases; 
	if (!(isset($dict_phrases) && isset($dict_phrases[$lang][$phrase]))) { 
		return $phrase; 
	} 
 
	$translation = $dict_phrases[$lang][$phrase]; 
 
	if (!empty($translation)) { 
		$pattern = '/\\{\\-\\-\\-[0-9]\\}/'; 
 
		if (preg_match($pattern, $translation)) { 
			preg_match_all($pattern, $translation, $matches); 
 
			if (count($matches[0]) != count($options)) { 
				return $translation; 
			} 
 
			foreach ($matches[0] as $match) { 
				$match_pos = substr($match, 4, 1); 
 
				if (empty($options[$match_pos - 1])) { 
					continue; 
				} 
 
				$translation = str_replace($match, $options[$match_pos - 1], $translation); 
			} 
 
			return $translation; 
		} 
 
		return $translation; 
	} 
 
	return $phrase; 
} 
 
function getdefaultbanks() 
{ 
	$bank_details = []; 
	$bank_names_and_codes_string = DEFAULT_BANKS_AND_CODES; 
 
	if (trim($bank_names_and_codes_string) != '') { 
		$bank_names_and_codes_array = explode('|', $bank_names_and_codes_string); 
 
		if (!empty($bank_names_and_codes_array)) { 
			foreach ($bank_names_and_codes_array as $bankandcodes) { 
				$name_and_code_arr = explode('->', $bankandcodes); 
				$bank_details[$name_and_code_arr[1]] = $name_and_code_arr[0]; 
			} 
 
			if (!empty($bank_details)) { 
				$bank_details['xxx'] = 'Other...'; 
			} 
			else { 
				$bank_details['000'] = 'Select bank'; 
				$bank_details['xxx'] = 'Other...'; 
			} 
		} 
		else { 
			$bank_details['000'] = 'Select bank'; 
			$bank_details['xxx'] = 'Other...'; 
		} 
	} 
	else { 
		$bank_details['000'] = 'Select bank'; 
		$bank_details['xxx'] = 'Other...'; 
	} 
 
	return $bank_details; 
} 
 
function get_domain($url) 
{ 
	$pieces = parse_url($url); 
	$domain = (isset($pieces['host']) ? $pieces['host'] : $pieces['path']); 
 
	if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\\-]{1,63}\\.[a-z\\.]{2,6})$/i', $domain, $regs)) { 
		return $regs['domain']; 
	} 
 
	return false; 
} 
 
function getBearing($lat1, $lng1, $lat2, $lng2) 
{ 
	$pi = pi(); 
	$lat1 = ($lat1 * $pi) / 180; 
	$lng1 = ($lng1 * $pi) / 180; 
	$lat2 = ($lat2 * $pi) / 180; 
	$lng2 = ($lng2 * $pi) / 180; 
	$dlon = $lng2 - $lng1; 
	$y = sin($dlon) * cos($lat2); 
	$x = cos($dlon) * (cos($lat2) * (cos($lat1) * (sin($lat2) - sin($lat1)))); 
	$brng = atan2($y, $x); 
	$brng = rad2deg($brng); 
	$brng = (int) ($brng + 360) % 360; 
	return $brng; 
} 
 
function validatePhoneNumber($phone_number) 
{ 
	$phoneUtil = libphonenumber\PhoneNumberUtil::getInstance(); 
	$phoneNumberObject = NULL; 
 
	try { 
		$phoneNumberObject = $phoneUtil->parse($phone_number, 'IN'); 
	} 
	catch (libphonenumber\NumberParseException $e) { 
		return ['error' => 1]; 
	} 
 
	if ($phoneUtil->isPossibleNumber($phoneNumberObject)) { 
		$phone_num_formatted_nat = $phoneUtil->format($phoneNumberObject, libphonenumber\PhoneNumberFormat::NATIONAL); 
		$phone_num_formatted_nat = str_replace(' ', '', $phone_num_formatted_nat); 
		$phone_num_formatted_nat = str_replace('-', '', $phone_num_formatted_nat); 
		$phone_num_formatted_nat = str_replace('(', '', $phone_num_formatted_nat); 
		$phone_num_formatted_nat = str_replace(')', '', $phone_num_formatted_nat); 
		$phone_num_formatted_int = $phoneUtil->format($phoneNumberObject, libphonenumber\PhoneNumberFormat::E164); 
		return ['success' => 1, 'phone_num_nat' => $phone_num_formatted_nat, 'phone_num_int' => $phone_num_formatted_int]; 
	} 
 
	return ['error' => 1]; 
} 
 
function verifyFirebaseUser($fb_user) 
{ 
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json'); 
	$auth = $factory_fbsdk->createAuth(); 
 
	try { 
		$user_details = $auth->getUser($fb_user['uid']); 
	} 
	catch (Throwable $e) { 
		return ['error' => 1]; 
	} 
 
	return ['success' => 1, 'data' => $user_details]; 
} 
 
function sendPushNotification($title, $body, $device_tokens, $data = NULL, $show = '1', $sound = 0, $image = NULL) 
{ 
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json'); 
	$notification_config = [ 
		'android' => [ 
		'priority'     => 'high', 
		'notification' => ['sound' => (!empty($sound) && empty($data) ? 'notify' : 'default'), 'channel_id' => (!empty($sound) && empty($data) ? 'droptaxi_notify_1' : '')] 
	], 
		'apns'    => [ 
		'headers'     => ['apns-priority' => '10'], 
		'payload'     => [ 
		'aps' => ['sound' => (!empty($sound) && empty($data) ? 'notify.mp3' : 'default')] 
	], 
		'fcm_options' => ['image' => (!empty($image) ? $image : '')] 
	] 
	]; 
 
	if (preg_match('/\\/topics\\//', $device_tokens)) { 
		$topic = str_replace('/topics/', '', $device_tokens); 
		$notification_config['topic'] = $topic; 
	} 
	else { 
		$notification_config['token'] = $device_tokens; 
	} 
 
	if (empty($data)) { 
		$notification_config['notification'] = ['title' => $title, 'body' => $body, 'image' => (!empty($image) ? $image : '')]; 
		$notification_config['data'] = ['show' => strval($show), 'msg' => ($show == '1' ? json_encode(['title' => $title, 'message' => $body]) : '')]; 
	} 
	else { 
		$data_sanitized = []; 
 
		foreach ($data as $key => $val) { 
			$data_sanitized[$key] = strval($val); 
		} 
 
		unset($notification_config['android']['notification']); 
		$notification_config['apns']['payload']['aps']['content-available'] = 1; 
		$notification_config['data'] = $data_sanitized; 
	} 
 
	$messaging = $factory_fbsdk->createMessaging(); 
 
	try { 
		$message = new Kreait\Firebase\Messaging\RawMessageFromArray($notification_config); 
		$messaging->send($message); 
	} 
	catch (Throwable $e) { 
		return ['error' => 1, 'msg' => $e]; 
	} 
 
	return ['success' => 1]; 
} 
 
function emulateDirectionService($p_lat, $p_lng, $d_lat, $d_lng, $mode = 0, $waypoints = []) 
{ 
	require_once 'polyline.php'; 
	$distance_meters_total = 0; 
	$distance = 0; 
	$duration_secs = 0; 
	$distance_meters = 0; 
	$waypoints_str = ''; 
	global $settings_data2; 
 
	if (empty($waypoints)) { 
		$distance = distance($p_lat, $p_lng, $d_lat, $d_lng); 
		$distance_meters = ceil($distance * 1000); 
		$distance_meters += ($distance_meters * 2) / 3; 
		$duration_secs = ceil($distance_meters / 15.56); 
 
		if ($duration_secs) { 
			$hours = floor($duration_secs / 3600); 
			$minutes = floor(($duration_secs % 3600) / 60); 
			$seconds = $duration_secs % 3600 % 60; 
			$ride_duration_text = ''; 
 
			if (!empty($hours)) { 
				$ride_duration_text = $hours . 'hr '; 
			} 
 
			if (!empty($minutes)) { 
				$ride_duration_text .= $minutes . 'mins '; 
			} 
 
			if (!empty($seconds)) { 
				$ride_duration_text .= $seconds . 'secs'; 
			} 
		} 
		else { 
			$ride_duration_text = '0secs'; 
		} 
 
		if (1000 <= $distance_meters) { 
			$distance_text = round($distance_meters / 1000, 1) . 'km'; 
		} 
		else { 
			$distance_text = $distance_meters . 'm'; 
		} 
 
		$lat_diff = abs($p_lat - $d_lat); 
		$lng_diff = abs($p_lng - $d_lng); 
		$dir_lat = 1; 
		$dir_lng = 1; 
 
		if ($d_lat < $p_lat) { 
			$dir_lat = -1; 
		} 
 
		if ($d_lng < $p_lng) { 
			$dir_lng = -1; 
		} 
 
		$polylineEncoder = new PolylineEncoder(); 
		$polylineEncoder->addPoint($p_lat, $p_lng); 
		$num_points = 50; 
 
		for ($i = 1; $i < $num_points; ++$i) { 
			$i_lat = $lat_diff * ($i / $num_points); 
			$i_lng = $lng_diff * ($i / $num_points); 
			$polylineEncoder->addPoint($p_lat + ($i_lat * $dir_lat), $p_lng + ($i_lng * $dir_lng)); 
		} 
 
		$polylineEncoder->addPoint($d_lat, $d_lng); 
	} 
	else { 
		if (!empty($waypoints[0]) && !empty($waypoints[1])) { 
			$waypoints_str = '&waypoints=via:' . $waypoints[0]['lat'] . ',' . $waypoints[0]['lng'] . '|' . $waypoints[1]['lat'] . ',' . $waypoints[1]['lng']; 
		} 
		else if (!empty($waypoints[0])) { 
			$waypoints_str = '&waypoints=via:' . $waypoints[0]['lat'] . ',' . $waypoints[0]['lng']; 
		} 
 
		$num_point_per_seg = (count($waypoints) == 1 ? 25 : 16); 
		$points_arr = $waypoints; 
		array_unshift($points_arr, ['lat' => $p_lat, 'lng' => $p_lng]); 
		array_push($points_arr, ['lat' => $d_lat, 'lng' => $d_lng]); 
		$polylineEncoder = new PolylineEncoder(); 
 
		for ($x = 0; $x < (count($points_arr) - 1); ++$x) { 
			$start_lat = $points_arr[$x]['lat']; 
			$start_lng = $points_arr[$x]['lng']; 
			$end_lat = $points_arr[$x + 1]['lat']; 
			$end_lng = $points_arr[$x + 1]['lng']; 
			$distance = distance($start_lat, $start_lng, $end_lat, $end_lng); 
			$distance_meters = ceil($distance * 1000); 
			$distance_meters_total += $distance_meters; 
			$lat_diff = abs($start_lat - $end_lat); 
			$lng_diff = abs($start_lng - $end_lng); 
			$dir_lat = 1; 
			$dir_lng = 1; 
 
			if ($end_lat < $start_lat) { 
				$dir_lat = -1; 
			} 
 
			if ($end_lng < $start_lng) { 
				$dir_lng = -1; 
			} 
 
			$polylineEncoder->addPoint($start_lat, $start_lng); 
			$num_points = $num_point_per_seg; 
 
			for ($i = 1; $i < $num_points; ++$i) { 
				$i_lat = $lat_diff * ($i / $num_points); 
				$i_lng = $lng_diff * ($i / $num_points); 
				$polylineEncoder->addPoint($start_lat + ($i_lat * $dir_lat), $start_lng + ($i_lng * $dir_lng)); 
			} 
 
			$polylineEncoder->addPoint($end_lat, $end_lng); 
		} 
 
		$distance_meters_total += ($distance_meters_total * 2) / 3; 
		$distance_meters = $distance_meters_total; 
		$duration_secs = ceil($distance_meters / 15.56); 
 
		if ($duration_secs) { 
			$hours = floor($duration_secs / 3600); 
			$minutes = floor(($duration_secs % 3600) / 60); 
			$seconds = $duration_secs % 3600 % 60; 
			$ride_duration_text = ''; 
 
			if (!empty($hours)) { 
				$ride_duration_text = $hours . 'hr '; 
			} 
 
			if (!empty($minutes)) { 
				$ride_duration_text .= $minutes . 'mins '; 
			} 
 
			if (!empty($seconds)) { 
				$ride_duration_text .= $seconds . 'secs'; 
			} 
		} 
		else { 
			$ride_duration_text = '0secs'; 
		} 
 
		if (1000 <= $distance_meters) { 
			$distance_text = round($distance_meters / 1000, 1) . 'km'; 
		} 
		else { 
			$distance_text = $distance_meters . 'm'; 
		} 
	} 
 
	$encodedString = $polylineEncoder->encodedString(); 
	$data = [ 
		'routes' => [ 
		[ 
		'legs'              => [ 
		[ 
		'duration' => ['value' => $duration_secs, 'text' => $ride_duration_text], 
		'distance' => ['value' => $distance_meters, 'text' => $distance_text] 
	] 
	], 
		'overview_polyline' => ['points' => $encodedString] 
	] 
	], 
		'status' => 'OK' 
	]; 
 
	if ($mode) { 
		return $data; 
	} 
 
	$url = 'https://maps.googleapis.com/maps/api/directions/json?origin=' . $p_lat . ',' . $p_lng . '&destination=' . $d_lat . ',' . $d_lng . '&key=' . $settings_data2['google-maps-api-key'] . $waypoints_str; 
	$curl = curl_init($url); 
	curl_setopt($curl, CURLOPT_HEADER, false); 
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
	curl_setopt($curl, CURLOPT_HTTPGET, true); 
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
	$json_response = curl_exec($curl); 
	$status = curl_getinfo($curl, CURLINFO_HTTP_CODE); 
	curl_close($curl); 
	$json_arr = json_decode($json_response, true); 
 
	if (json_last_error()) { 
		return $data; 
	} 
 
	if (!isset($json_arr['routes'])) { 
		return $data; 
	} 
 
	return $json_arr; 
} 
 
$license_data = []; 
$settings_data = []; 
$settings_data2 = []; 
$settings_data3 = []; 
$settings_data4 = []; 
@$file_check = include 'license.php'; 
 
if (!$file_check) { 
	header('location: /activate.php'); 
	exit(); 
} 
 
$host = parse_url($license_data['domain_url'])['host']; 
$domain_name = get_domain($license_data['domain_url']); 
if (!empty($license_data['license_key']) && !empty($host) && !empty($license_data['purchase_code'])) { 
	$comp_license_key = sha1($host . $license_data['purchase_code'] . 'Droptaxibyprojectgicsdev'); 
 
	if ($comp_license_key != $license_data['license_key']) { 
		header('location: /activate.php'); 
		exit(); 
	} 
} 
else { 
	header('location: /activate.php'); 
	exit(); 
} 
 
require 'settingsdata.php'; 
require 'settingsdata2.php'; 
require 'settingsdata3.php'; 
require 'settingsdata4.php'; 
require 'options.php'; 
require_once dirname(__DIR__) . '/vendor/autoload.php'; 
require FILES_FOLDER . '/PHPMailer/src/Exception.php'; 
require FILES_FOLDER . '/PHPMailer/src/PHPMailer.php'; 
require FILES_FOLDER . '/PHPMailer/src/SMTP.php'; 
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 1 && SESSION_TIMEOUT_ENABLE) { 
	if (!isset($_SESSION['last_activity'])) { 
		$_SESSION['last_activity'] = time(); 
	} 
 
	if (SESSION_TIMEOUT < (time() - $_SESSION['last_activity'])) { 
		unset($_SESSION['last_activity']); 
		$_SESSION['expired_session'] = 1; 
	} 
	else { 
		$_SESSION['last_activity'] = time(); 
	} 
} 
 
$error = []; 
$error_ = []; 
$messages = []; 
$messages_ = []; 
$template['breadcrumbs'] = []; 
 
if (MAINTENANCE_MODE) { 
	$ip_addresses = explode(',', IP_ALLOW); 
	$found = array_search($_SERVER['REMOTE_ADDR'], $ip_addresses); 
 
	if (!$found !== false) { 
		header('location: ' . SITE_URL . 'maintenance.php', true, 302); 
		exit(); 
	} 
} 
if (isset($_SESSION['timezone']) && isvalidtimezoneid($_SESSION['timezone'])) { 
	date_default_timezone_set($_SESSION['timezone']); 
} 
else { 
	date_default_timezone_set('Europe/Vienna'); 
} 
 
?>

Did this file decode correctly?

Original Code

<?php
/*
 * ------------------------------------------------------
 *  Drop - Advanced PHP 
 * ------------------------------------------------------
 *  Official Website : https://
 *  Version          : 7.6.0.0
 *  Author           : Drop Team
 *  Release Date     : 2024-09-15
 * ------------------------------------------------------
 *   2024 Drop.Net - All Rights Reserved.
 *  This file is part of the Drop software package.
 */

function in_array_r($item, $array)
{
	$item = preg_quote($item);
	return preg_match('/"' . $item . '"/i', json_encode($array));
}

function codeToCountryName($code)
{
	$code = strtoupper($code);
	$countryList = ['AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas the', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island (Bouvetoya)', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory (Chagos Archipelago)', 'VG' => 'British Virgin Islands', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros the', 'CD' => 'Congo', 'CG' => 'Congo the', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote d\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FO' => 'Faroe Islands', 'FK' => 'Falkland Islands (Malvinas)', 'FJ' => 'Fiji the Fiji Islands', 'FI' => 'Finland', 'FR' => 'France, French Republic', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia the', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GG' => 'Guernsey', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and McDonald Islands', 'VA' => 'Holy See (Vatican City State)', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IM' => 'Isle of Man', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JE' => 'Jersey', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyz Republic', 'LA' => 'Lao', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'AN' => 'Netherlands Antilles', 'NL' => 'Netherlands the', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => 'Palestinian Territory', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Islands', 'PL' => 'Poland', 'PT' => 'Portugal, Portuguese Republic', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'BL' => 'Saint Barthelemy', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'MF' => 'Saint Martin', 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia (Slovak Republic)', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia, Somali Republic', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard & Jan Mayen Islands', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland, Swiss Confederation', 'SY' => 'Syrian Arab Republic', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TL' => 'Timor-Leste', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'United Kingdom', 'US' => 'United States of America', 'UM' => 'United States Minor Outlying Islands', 'VI' => 'United States Virgin Islands', 'UY' => 'Uruguay, Eastern Republic of', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'WF' => 'Wallis and Futuna', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe'];
	return (isset($countryList[$code]) ? $countryList[$code] : false);
}

function CountryNametoCode($name)
{
	$countryList = ['AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas the', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island (Bouvetoya)', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory (Chagos Archipelago)', 'VG' => 'British Virgin Islands', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Colombia', 'KM' => 'Comoros the', 'CD' => 'Congo', 'CG' => 'Congo the', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote d\'Ivoire', 'HR' => 'Croatia', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FO' => 'Faroe Islands', 'FK' => 'Falkland Islands (Malvinas)', 'FJ' => 'Fiji the Fiji Islands', 'FI' => 'Finland', 'FR' => 'France, French Republic', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia the', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GG' => 'Guernsey', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and McDonald Islands', 'VA' => 'Holy See (Vatican City State)', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IM' => 'Isle of Man', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JE' => 'Jersey', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KP' => 'Korea', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyz Republic', 'LA' => 'Lao', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libyan Arab Jamahiriya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'ME' => 'Montenegro', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'AN' => 'Netherlands Antilles', 'NL' => 'Netherlands the', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PS' => 'Palestinian Territory', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Islands', 'PL' => 'Poland', 'PT' => 'Portugal, Portuguese Republic', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russian Federation', 'RW' => 'Rwanda', 'BL' => 'Saint Barthelemy', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts and Nevis', 'LC' => 'Saint Lucia', 'MF' => 'Saint Martin', 'PM' => 'Saint Pierre and Miquelon', 'VC' => 'Saint Vincent and the Grenadines', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'Sao Tome and Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'RS' => 'Serbia', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia (Slovak Republic)', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia, Somali Republic', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard & Jan Mayen Islands', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland, Swiss Confederation', 'SY' => 'Syrian Arab Republic', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TL' => 'Timor-Leste', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'GB' => 'United Kingdom', 'US' => 'United States of America', 'UM' => 'United States Minor Outlying Islands', 'VI' => 'United States Virgin Islands', 'UY' => 'Uruguay, Eastern Republic of', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'WF' => 'Wallis and Futuna', 'EH' => 'Western Sahara', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe'];

	if ($x = array_search(strtolower($name), array_map('strtolower', $countryList))) {
		return $x;
	}
	else {
		return 'NG';
	}
}

function random_text($count, $rm_similar = false)
{
	$chars = array_flip(array_merge(range(0, 9), range('A', 'Z')));

	if ($rm_similar) {
		unset($chars[0]);
		unset($chars[1]);
		unset($chars[2]);
		unset($chars[5]);
		unset($chars[8]);
		unset($chars['B']);
		unset($chars['I']);
		unset($chars['O']);
		unset($chars['Q']);
		unset($chars['S']);
		unset($chars['U']);
		unset($chars['V']);
		unset($chars['Z']);
	}

	$text = '';

	for ($i = 0; $i < $count; ++$i) {
		$text .= array_rand($chars);
	}

	return $text;
}

function isValidDate($date, $format = 'Y-m-d')
{
	return $date == date($format, strtotime($date));
}

function isValidTimezoneId($timezoneId)
{
	try {
		new DateTimeZone($timezoneId);
	}
	catch (PHPMailer\PHPMailer\Exception $e) {
		return false;
	}

	return true;
}

function formatBytes($bytes, $precision = 2)
{
	if (pow(1024, 3) < $bytes) {
		return round($bytes / pow(1024, 3), $precision) . 'GB';
	}
	else if (pow(1024, 2) < $bytes) {
		return round($bytes / pow(1024, 2), $precision) . 'MB';
	}
	else if (1024 < $bytes) {
		return round($bytes / 1024, $precision) . 'KB';
	}
	else {
		return $bytes . 'B';
	}
}

function recursive_array_search($needle, $haystack)
{
	foreach ($haystack as $key => $value) {
		$current_key = $key;
		if (($needle === $value) || is_array($value) && recursive_array_search($needle, $value) !== false) {
			return $current_key;
		}
	}

	return false;
}

function seo_process($values)
{
	if (!is_array($values)) {
		return NULL;
	}

	$GLOBALS['admin_template']['seo']['title'] = (isset($values['title']) ? $values['title'] : NULL);
	$GLOBALS['admin_template']['seo']['author'] = (isset($values['author']) ? $values['author'] : NULL);
	$GLOBALS['admin_template']['seo']['description'] = (isset($values['description']) ? $values['description'] : NULL);
	$GLOBALS['admin_template']['seo']['type'] = (isset($values['type']) ? $values['type'] : NULL);
	$GLOBALS['admin_template']['seo']['url'] = (isset($values['url']) ? $values['url'] : NULL);
	$GLOBALS['admin_template']['seo']['category'] = (isset($values['category']) ? $values['category'] : NULL);
	$GLOBALS['admin_template']['seo']['date_created'] = (isset($values['date_created']) ? $values['date_created'] : NULL);
	$GLOBALS['admin_template']['seo']['date_modified'] = (isset($values['date_modified']) ? $values['date_modified'] : NULL);
	$GLOBALS['admin_template']['seo']['image'] = (isset($values['image']) ? $values['image'] : NULL);
	$GLOBALS['admin_template']['seo']['robot_not_crawl'] = (isset($values['nofollow']) ? 1 : NULL);
}

function crypto_string($type = 'alnum', $length = 13)
{
	switch ($type) {
	case 'alnum':
		$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
		break;
	case 'alpha':
		$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
		break;
	case 'hexdec':
		$pool = '0123456789abcdef';
		break;
	case 'numeric':
		$pool = '0123456789';
		break;
	case 'nozero':
		$pool = '123456789';
		break;
	case 'distinct':
		$pool = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
		break;
	case 'distinct2':
		$pool = '2345679ACDEFHJKLMNPRSTUVWXYZ';
		break;
	default:
		$pool = (string) $type;
		break;
	}
	$crypto_rand_secure = function($min, $max) {
		$rnd = 0;
		$range = $max - $min;

		if ($range < 0) {
			return $min;
		}

		$log = log($range, 2);
		$bytes = (int) ($log / 8) + 1;
		$bits = (int) $log + 1;
		$filter = (int) (1 << $bits) - 1;

		do {
			$rnd = hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
			$rnd = $rnd & $filter;
		} while ($range <= $rnd);

		return $min + $rnd;
	};
	$token = '';
	$max = strlen($pool);

	for ($i = 0; $i < $length; ++$i) {
		$token .= $pool[$crypto_rand_secure(0, $max)];
	}

	return $token;
}

function mask_email($email, $mask_char = '*', $percent = 50)
{
	if (empty($email)) {
		return '';
	}

	list($user, $domain) = preg_split('/@/', $email);
	$len = strlen($user);
	$mask_count = floor(($len * $percent) / 100);
	$offset = floor(($len - $mask_count) / 2);
	$masked = substr($user, 0, $offset) . str_repeat($mask_char, $mask_count) . substr($user, $mask_count + $offset);
	return $masked . '@' . $domain;
}

function mask_string($string, $mask_char = '*', $percent = 40)
{
	if (empty($string)) {
		return '';
	}

	$len = strlen($string);
	$mask_count = floor(($len * $percent) / 100);
	$offset = floor(($len - $mask_count) / 2);
	$masked = substr($string, 0, $offset) . str_repeat($mask_char, $mask_count) . substr($string, $mask_count + $offset);
	return $masked;
}

function encodeStr($string, $key = 'projectgics')
{
	$key = sha1($key);
	$j = 0;
	$strLen = strlen($string);
	$keyLen = strlen($key);
	$hash = '';

	for ($i = 0; $i < $strLen; ++$i) {
		$ordStr = ord(substr($string, $i, 1));

		if ($j == $keyLen) {
			$j = 0;
		}

		$ordKey = ord(substr($key, $j, 1));
		++$j;
		$hash .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36));
	}

	return $hash;
}

function decodeStr($string, $key = 'projectgics')
{
	$key = sha1($key);
	$j = 0;
	$strLen = strlen($string);
	$keyLen = strlen($key);
	$hash = '';
	$i = 0;

	while ($i < $strLen) {
		$ordStr = hexdec(base_convert(strrev(substr($string, $i, 2)), 36, 16));

		if ($j == $keyLen) {
			$j = 0;
		}

		$ordKey = ord(substr($key, $j, 1));
		++$j;
		$hash .= chr($ordStr - $ordKey);
		$i += 2;
	}

	return $hash;
}

function sendRealTimeNotification($target, $data)
{
	global $settings_data2;

	if (empty($settings_data2['firebase-rtdb-url'])) {
		return ['error' => 1];
	}

	$fb_database_url = (substr($settings_data2['firebase-rtdb-url'], -1, 1) == '/' ? $settings_data2['firebase-rtdb-url'] : $settings_data2['firebase-rtdb-url'] . '/');
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json')->withDatabaseUri($fb_database_url);
	$user_type = substr($target, 0, 4);

	if ($user_type == 'drvr') {
		$db_node = 'Drivers';
	}
	else if ($user_type == 'ridr') {
		$db_node = 'Riders';
	}
	else {
		return ['error' => 1];
	}

	try {
		$db = $factory_fbsdk->createDatabase();
		$db->getReference($db_node . '/' . $target)->set([
			'notf' => ['msg' => $data, 'msg_t' => time()]
		]);
		return ['success' => 1];
	}
	catch (Throwable $e) {
		return ['error' => 1];
	}
}

function floattocurrency($amount)
{
	$amount = (float) $amount;
	return number_format($amount, 2);
}

function distance($lat1, $lon1, $lat2, $lon2)
{
	$lat1 = (float) $lat1;
	$lon1 = (float) $lon1;
	$lat2 = (float) $lat2;
	$lon2 = (float) $lon2;
	$pi80 = M_PI / 180;
	$lat1 *= $pi80;
	$lon1 *= $pi80;
	$lat2 *= $pi80;
	$lon2 *= $pi80;
	$r = 6372.797;
	$dlat = $lat2 - $lat1;
	$dlon = $lon2 - $lon1;
	$a = (sin($dlat / 2) * sin($dlat / 2)) + (sin($dlon / 2) * (sin($dlon / 2) * (cos($lat1) * cos($lat2))));
	$c = atan2(sqrt($a), sqrt(1 - $a)) * 2;
	$km = $r * $c;
	return $km;
}

function sendMail($to = '', $subject = '', $message = '', $smtp_test = [])
{
	$mail = new PHPMailer\PHPMailer\PHPMailer(true);

	try {
		if (empty($smtp_test)) {
			if (!SMTP_HOST || !SMTP_USERNAME || !SMTP_PWD || !MAIL_SENDER) {
				$data = ['response' => 0, 'message' => 'Incorrect email settings'];
				return $data;
			}

			$smtp_hostname = SMTP_HOST;
			$smtp_username = SMTP_USERNAME;
			$smtp_password = SMTP_PWD;
			$smtp_mail_sender = MAIL_SENDER;
		}
		else {
			$smtp_hostname = $smtp_test['host'];
			$smtp_username = $smtp_test['username'];
			$smtp_password = $smtp_test['password'];
			$smtp_mail_sender = $smtp_test['username'];
		}

		$mail->isSMTP();
		$mail->Host = $smtp_hostname;
		$mail->SMTPAuth = true;
		$mail->Username = $smtp_username;
		$mail->Password = $smtp_password;
		$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS;
		$mail->Port = 465;
		$mail->setFrom($smtp_mail_sender, WEBSITE_NAME);
		$mail->addAddress($to);
		$mail->isHTML(true);
		$mail->Subject = $subject;
		$mail->Body = $message;
		$mail->send();
		$data = ['response' => 1, 'message' => 'Message has been sent'];
		return $data;
	}
	catch (PHPMailer\PHPMailer\Exception $e) {
		$data = ['response' => 0, 'message' => $mail->ErrorInfo];
		return $data;
	}
}

function __($phrase, $options = [], $lang = '')
{
	if (!empty($lang)) {
		$lang_options = explode('|', $lang);

		if (is_array($lang_options)) {
			if ($lang_options[0] == 'r') {
				include FILES_FOLDER . ('/lang/rider/' . $lang_options[1] . '.php');
			}
			else if ($lang_options[0] == 'd') {
				include FILES_FOLDER . ('/lang/driver/' . $lang_options[1] . '.php');
			}
			else {
				global $lang_phrases;
			}
		}
		else {
			global $lang_phrases;
		}
	}
	else {
		global $lang_phrases;
	}
	if (!(isset($lang_phrases) && isset($lang_phrases[$phrase]))) {
		return $phrase;
	}

	$translation = $lang_phrases[$phrase];

	if (!empty($translation)) {
		$pattern = '/\\{\\-\\-\\-[0-9]\\}/';

		if (preg_match($pattern, $translation)) {
			preg_match_all($pattern, $translation, $matches);

			if (count($matches[0]) != count($options)) {
				return $translation;
			}

			foreach ($matches[0] as $match) {
				$match_pos = (int) substr($match, 4, 1);

				if (empty($options[$match_pos - 1])) {
					continue;
				}

				$translation = str_replace($match, $options[$match_pos - 1], $translation);
			}

			return $translation;
		}

		return $translation;
	}

	return $phrase;
}

function ___($phrase, $options = [], $lang = 'en')
{
	global $dict_phrases;
	if (!(isset($dict_phrases) && isset($dict_phrases[$lang][$phrase]))) {
		return $phrase;
	}

	$translation = $dict_phrases[$lang][$phrase];

	if (!empty($translation)) {
		$pattern = '/\\{\\-\\-\\-[0-9]\\}/';

		if (preg_match($pattern, $translation)) {
			preg_match_all($pattern, $translation, $matches);

			if (count($matches[0]) != count($options)) {
				return $translation;
			}

			foreach ($matches[0] as $match) {
				$match_pos = substr($match, 4, 1);

				if (empty($options[$match_pos - 1])) {
					continue;
				}

				$translation = str_replace($match, $options[$match_pos - 1], $translation);
			}

			return $translation;
		}

		return $translation;
	}

	return $phrase;
}

function getdefaultbanks()
{
	$bank_details = [];
	$bank_names_and_codes_string = DEFAULT_BANKS_AND_CODES;

	if (trim($bank_names_and_codes_string) != '') {
		$bank_names_and_codes_array = explode('|', $bank_names_and_codes_string);

		if (!empty($bank_names_and_codes_array)) {
			foreach ($bank_names_and_codes_array as $bankandcodes) {
				$name_and_code_arr = explode('->', $bankandcodes);
				$bank_details[$name_and_code_arr[1]] = $name_and_code_arr[0];
			}

			if (!empty($bank_details)) {
				$bank_details['xxx'] = 'Other...';
			}
			else {
				$bank_details['000'] = 'Select bank';
				$bank_details['xxx'] = 'Other...';
			}
		}
		else {
			$bank_details['000'] = 'Select bank';
			$bank_details['xxx'] = 'Other...';
		}
	}
	else {
		$bank_details['000'] = 'Select bank';
		$bank_details['xxx'] = 'Other...';
	}

	return $bank_details;
}

function get_domain($url)
{
	$pieces = parse_url($url);
	$domain = (isset($pieces['host']) ? $pieces['host'] : $pieces['path']);

	if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\\-]{1,63}\\.[a-z\\.]{2,6})$/i', $domain, $regs)) {
		return $regs['domain'];
	}

	return false;
}

function getBearing($lat1, $lng1, $lat2, $lng2)
{
	$pi = pi();
	$lat1 = ($lat1 * $pi) / 180;
	$lng1 = ($lng1 * $pi) / 180;
	$lat2 = ($lat2 * $pi) / 180;
	$lng2 = ($lng2 * $pi) / 180;
	$dlon = $lng2 - $lng1;
	$y = sin($dlon) * cos($lat2);
	$x = cos($dlon) * (cos($lat2) * (cos($lat1) * (sin($lat2) - sin($lat1))));
	$brng = atan2($y, $x);
	$brng = rad2deg($brng);
	$brng = (int) ($brng + 360) % 360;
	return $brng;
}

function validatePhoneNumber($phone_number)
{
	$phoneUtil = libphonenumber\PhoneNumberUtil::getInstance();
	$phoneNumberObject = NULL;

	try {
		$phoneNumberObject = $phoneUtil->parse($phone_number, 'IN');
	}
	catch (libphonenumber\NumberParseException $e) {
		return ['error' => 1];
	}

	if ($phoneUtil->isPossibleNumber($phoneNumberObject)) {
		$phone_num_formatted_nat = $phoneUtil->format($phoneNumberObject, libphonenumber\PhoneNumberFormat::NATIONAL);
		$phone_num_formatted_nat = str_replace(' ', '', $phone_num_formatted_nat);
		$phone_num_formatted_nat = str_replace('-', '', $phone_num_formatted_nat);
		$phone_num_formatted_nat = str_replace('(', '', $phone_num_formatted_nat);
		$phone_num_formatted_nat = str_replace(')', '', $phone_num_formatted_nat);
		$phone_num_formatted_int = $phoneUtil->format($phoneNumberObject, libphonenumber\PhoneNumberFormat::E164);
		return ['success' => 1, 'phone_num_nat' => $phone_num_formatted_nat, 'phone_num_int' => $phone_num_formatted_int];
	}

	return ['error' => 1];
}

function verifyFirebaseUser($fb_user)
{
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json');
	$auth = $factory_fbsdk->createAuth();

	try {
		$user_details = $auth->getUser($fb_user['uid']);
	}
	catch (Throwable $e) {
		return ['error' => 1];
	}

	return ['success' => 1, 'data' => $user_details];
}

function sendPushNotification($title, $body, $device_tokens, $data = NULL, $show = '1', $sound = 0, $image = NULL)
{
	$factory_fbsdk = (new Kreait\Firebase\Factory())->withServiceAccount(dirname(__DIR__) . '/credentials.json');
	$notification_config = [
		'android' => [
		'priority'     => 'high',
		'notification' => ['sound' => (!empty($sound) && empty($data) ? 'notify' : 'default'), 'channel_id' => (!empty($sound) && empty($data) ? 'droptaxi_notify_1' : '')]
	],
		'apns'    => [
		'headers'     => ['apns-priority' => '10'],
		'payload'     => [
		'aps' => ['sound' => (!empty($sound) && empty($data) ? 'notify.mp3' : 'default')]
	],
		'fcm_options' => ['image' => (!empty($image) ? $image : '')]
	]
	];

	if (preg_match('/\\/topics\\//', $device_tokens)) {
		$topic = str_replace('/topics/', '', $device_tokens);
		$notification_config['topic'] = $topic;
	}
	else {
		$notification_config['token'] = $device_tokens;
	}

	if (empty($data)) {
		$notification_config['notification'] = ['title' => $title, 'body' => $body, 'image' => (!empty($image) ? $image : '')];
		$notification_config['data'] = ['show' => strval($show), 'msg' => ($show == '1' ? json_encode(['title' => $title, 'message' => $body]) : '')];
	}
	else {
		$data_sanitized = [];

		foreach ($data as $key => $val) {
			$data_sanitized[$key] = strval($val);
		}

		unset($notification_config['android']['notification']);
		$notification_config['apns']['payload']['aps']['content-available'] = 1;
		$notification_config['data'] = $data_sanitized;
	}

	$messaging = $factory_fbsdk->createMessaging();

	try {
		$message = new Kreait\Firebase\Messaging\RawMessageFromArray($notification_config);
		$messaging->send($message);
	}
	catch (Throwable $e) {
		return ['error' => 1, 'msg' => $e];
	}

	return ['success' => 1];
}

function emulateDirectionService($p_lat, $p_lng, $d_lat, $d_lng, $mode = 0, $waypoints = [])
{
	require_once 'polyline.php';
	$distance_meters_total = 0;
	$distance = 0;
	$duration_secs = 0;
	$distance_meters = 0;
	$waypoints_str = '';
	global $settings_data2;

	if (empty($waypoints)) {
		$distance = distance($p_lat, $p_lng, $d_lat, $d_lng);
		$distance_meters = ceil($distance * 1000);
		$distance_meters += ($distance_meters * 2) / 3;
		$duration_secs = ceil($distance_meters / 15.56);

		if ($duration_secs) {
			$hours = floor($duration_secs / 3600);
			$minutes = floor(($duration_secs % 3600) / 60);
			$seconds = $duration_secs % 3600 % 60;
			$ride_duration_text = '';

			if (!empty($hours)) {
				$ride_duration_text = $hours . 'hr ';
			}

			if (!empty($minutes)) {
				$ride_duration_text .= $minutes . 'mins ';
			}

			if (!empty($seconds)) {
				$ride_duration_text .= $seconds . 'secs';
			}
		}
		else {
			$ride_duration_text = '0secs';
		}

		if (1000 <= $distance_meters) {
			$distance_text = round($distance_meters / 1000, 1) . 'km';
		}
		else {
			$distance_text = $distance_meters . 'm';
		}

		$lat_diff = abs($p_lat - $d_lat);
		$lng_diff = abs($p_lng - $d_lng);
		$dir_lat = 1;
		$dir_lng = 1;

		if ($d_lat < $p_lat) {
			$dir_lat = -1;
		}

		if ($d_lng < $p_lng) {
			$dir_lng = -1;
		}

		$polylineEncoder = new PolylineEncoder();
		$polylineEncoder->addPoint($p_lat, $p_lng);
		$num_points = 50;

		for ($i = 1; $i < $num_points; ++$i) {
			$i_lat = $lat_diff * ($i / $num_points);
			$i_lng = $lng_diff * ($i / $num_points);
			$polylineEncoder->addPoint($p_lat + ($i_lat * $dir_lat), $p_lng + ($i_lng * $dir_lng));
		}

		$polylineEncoder->addPoint($d_lat, $d_lng);
	}
	else {
		if (!empty($waypoints[0]) && !empty($waypoints[1])) {
			$waypoints_str = '&waypoints=via:' . $waypoints[0]['lat'] . ',' . $waypoints[0]['lng'] . '|' . $waypoints[1]['lat'] . ',' . $waypoints[1]['lng'];
		}
		else if (!empty($waypoints[0])) {
			$waypoints_str = '&waypoints=via:' . $waypoints[0]['lat'] . ',' . $waypoints[0]['lng'];
		}

		$num_point_per_seg = (count($waypoints) == 1 ? 25 : 16);
		$points_arr = $waypoints;
		array_unshift($points_arr, ['lat' => $p_lat, 'lng' => $p_lng]);
		array_push($points_arr, ['lat' => $d_lat, 'lng' => $d_lng]);
		$polylineEncoder = new PolylineEncoder();

		for ($x = 0; $x < (count($points_arr) - 1); ++$x) {
			$start_lat = $points_arr[$x]['lat'];
			$start_lng = $points_arr[$x]['lng'];
			$end_lat = $points_arr[$x + 1]['lat'];
			$end_lng = $points_arr[$x + 1]['lng'];
			$distance = distance($start_lat, $start_lng, $end_lat, $end_lng);
			$distance_meters = ceil($distance * 1000);
			$distance_meters_total += $distance_meters;
			$lat_diff = abs($start_lat - $end_lat);
			$lng_diff = abs($start_lng - $end_lng);
			$dir_lat = 1;
			$dir_lng = 1;

			if ($end_lat < $start_lat) {
				$dir_lat = -1;
			}

			if ($end_lng < $start_lng) {
				$dir_lng = -1;
			}

			$polylineEncoder->addPoint($start_lat, $start_lng);
			$num_points = $num_point_per_seg;

			for ($i = 1; $i < $num_points; ++$i) {
				$i_lat = $lat_diff * ($i / $num_points);
				$i_lng = $lng_diff * ($i / $num_points);
				$polylineEncoder->addPoint($start_lat + ($i_lat * $dir_lat), $start_lng + ($i_lng * $dir_lng));
			}

			$polylineEncoder->addPoint($end_lat, $end_lng);
		}

		$distance_meters_total += ($distance_meters_total * 2) / 3;
		$distance_meters = $distance_meters_total;
		$duration_secs = ceil($distance_meters / 15.56);

		if ($duration_secs) {
			$hours = floor($duration_secs / 3600);
			$minutes = floor(($duration_secs % 3600) / 60);
			$seconds = $duration_secs % 3600 % 60;
			$ride_duration_text = '';

			if (!empty($hours)) {
				$ride_duration_text = $hours . 'hr ';
			}

			if (!empty($minutes)) {
				$ride_duration_text .= $minutes . 'mins ';
			}

			if (!empty($seconds)) {
				$ride_duration_text .= $seconds . 'secs';
			}
		}
		else {
			$ride_duration_text = '0secs';
		}

		if (1000 <= $distance_meters) {
			$distance_text = round($distance_meters / 1000, 1) . 'km';
		}
		else {
			$distance_text = $distance_meters . 'm';
		}
	}

	$encodedString = $polylineEncoder->encodedString();
	$data = [
		'routes' => [
		[
		'legs'              => [
		[
		'duration' => ['value' => $duration_secs, 'text' => $ride_duration_text],
		'distance' => ['value' => $distance_meters, 'text' => $distance_text]
	]
	],
		'overview_polyline' => ['points' => $encodedString]
	]
	],
		'status' => 'OK'
	];

	if ($mode) {
		return $data;
	}

	$url = 'https://maps.googleapis.com/maps/api/directions/json?origin=' . $p_lat . ',' . $p_lng . '&destination=' . $d_lat . ',' . $d_lng . '&key=' . $settings_data2['google-maps-api-key'] . $waypoints_str;
	$curl = curl_init($url);
	curl_setopt($curl, CURLOPT_HEADER, false);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_HTTPGET, true);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
	$json_response = curl_exec($curl);
	$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
	curl_close($curl);
	$json_arr = json_decode($json_response, true);

	if (json_last_error()) {
		return $data;
	}

	if (!isset($json_arr['routes'])) {
		return $data;
	}

	return $json_arr;
}

$license_data = [];
$settings_data = [];
$settings_data2 = [];
$settings_data3 = [];
$settings_data4 = [];
@$file_check = include 'license.php';

if (!$file_check) {
	header('location: /activate.php');
	exit();
}

$host = parse_url($license_data['domain_url'])['host'];
$domain_name = get_domain($license_data['domain_url']);
if (!empty($license_data['license_key']) && !empty($host) && !empty($license_data['purchase_code'])) {
	$comp_license_key = sha1($host . $license_data['purchase_code'] . 'Droptaxibyprojectgicsdev');

	if ($comp_license_key != $license_data['license_key']) {
		header('location: /activate.php');
		exit();
	}
}
else {
	header('location: /activate.php');
	exit();
}

require 'settingsdata.php';
require 'settingsdata2.php';
require 'settingsdata3.php';
require 'settingsdata4.php';
require 'options.php';
require_once dirname(__DIR__) . '/vendor/autoload.php';
require FILES_FOLDER . '/PHPMailer/src/Exception.php';
require FILES_FOLDER . '/PHPMailer/src/PHPMailer.php';
require FILES_FOLDER . '/PHPMailer/src/SMTP.php';
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 1 && SESSION_TIMEOUT_ENABLE) {
	if (!isset($_SESSION['last_activity'])) {
		$_SESSION['last_activity'] = time();
	}

	if (SESSION_TIMEOUT < (time() - $_SESSION['last_activity'])) {
		unset($_SESSION['last_activity']);
		$_SESSION['expired_session'] = 1;
	}
	else {
		$_SESSION['last_activity'] = time();
	}
}

$error = [];
$error_ = [];
$messages = [];
$messages_ = [];
$template['breadcrumbs'] = [];

if (MAINTENANCE_MODE) {
	$ip_addresses = explode(',', IP_ALLOW);
	$found = array_search($_SERVER['REMOTE_ADDR'], $ip_addresses);

	if (!$found !== false) {
		header('location: ' . SITE_URL . 'maintenance.php', true, 302);
		exit();
	}
}
if (isset($_SESSION['timezone']) && isvalidtimezoneid($_SESSION['timezone'])) {
	date_default_timezone_set($_SESSION['timezone']);
}
else {
	date_default_timezone_set('Europe/Vienna');
}

?>

Function Calls

None

Variables

None

Stats

MD5 5820a75ddb8476005480f8aa70171994
Eval Count 0
Decode Time 110 ms