ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkeweb2/code/ajax/ |
<?php $GLOBALS["carriers_number"] = [ '096' => 'Viettel', '097' => 'Viettel', '098' => 'Viettel', '032' => 'Viettel', '033' => 'Viettel', '034' => 'Viettel', '035' => 'Viettel', '036' => 'Viettel', '037' => 'Viettel', '038' => 'Viettel', '039' => 'Viettel', '090' => 'Mobifone', '093' => 'Mobifone', '070' => 'Mobifone', '071' => 'Mobifone', '072' => 'Mobifone', '076' => 'Mobifone', '078' => 'Mobifone', '091' => 'Vinaphone', '094' => 'Vinaphone', '083' => 'Vinaphone', '084' => 'Vinaphone', '085' => 'Vinaphone', '087' => 'Vinaphone', '089' => 'Vinaphone', '099' => 'Gmobile', '092' => 'Vietnamobile', '056' => 'Vietnamobile', '058' => 'Vietnamobile', '095' => 'SFone' ]; /** * Check if a string is started with another string * * @param string $needle The string being searched for. * @param string $haystack The string being searched * @return bool true if $haystack is started with $needle */ function start_with($needle, $haystack) { $length = strlen($needle); return (substr($haystack, 0, $length) === $needle); } /** * Detect carrier name by phone number * * @param string $number The input phone number * @return bool Name of the carrier, false if not found */ function detect_number ($number) { $number = str_replace(array('-', '.', ' '), '', $number); // $number is not a phone number if (!preg_match('/^0[0-9]{9,10}$/', $number)) return false; // Store all start number in an array to search $start_numbers = array_keys($GLOBALS["carriers_number"]); foreach ($start_numbers as $start_number) { // if $start number found in $number then return value of $carriers_number array as carrier name if (start_with($start_number, $number)) { //return $GLOBALS["carriers_number"][$start_number]; return true; } } // if not found, return false return false; } $phone = $CORE->input['phone']??''; if(detect_number($phone)){ $arr_insert = array('phone' => $phone, 'email' => '', 'name' => '', 'website' => '', 'message' => '','ip'=>$CORE->ip,'time_post'=>date('Y-m-d H:i:s'),'status'=>'pending'); $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_contact_form WHERE phone='{$phone}' OR ip='{$CORE->ip}'")); if(!$row_check){ $DB->do_insert('tb_contact_form',$arr_insert); } } echo '1'; $DB->free_result(); $DB->close_db(); exit(); ?>