3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 1- connect to db require("DatabaseConfigegb1.php"); // define quesry //StartFrom $decrypted_txt = decrypt(str_replace(" ", "+",$_GET['number'])); // $decrypted_txt = str_replace(" ", "+",$_GET['number']); if( empty($decrypted_txt) ) { die("Error in number");} if( mb_substr($decrypted_txt, 0, 2)== "20"){ $decrypted_txtnew= substr_replace($decrypted_txt, "", 0, 2); }elseif (mb_substr($decrypted_txt, 0, 4)== "0020"){ $decrypted_txtnew= substr_replace($decrypted_txt, "", 0, 4); }elseif (mb_substr($decrypted_txt, 0, 3)== "020"){ $decrypted_txtnew= substr_replace($decrypted_txt, "", 0, 3); }elseif (mb_substr($decrypted_txt, 0, 1)== "0"){ $decrypted_txtnew= substr_replace($decrypted_txt, "", 0, 1); }else{ $decrypted_txtnew= $decrypted_txt; } $query="SELECT id as 'id' ,name as 'name', number as 'number', ' ' as 'addrass' FROM list_numbers WHERE MATCH(number,name) AGAINST('%" . $decrypted_txtnew. "') GROUP BY name UNION SELECT id as 'id' ,name as 'name', number as 'number', ' ' as 'addrass' FROM list_numbers WHERE MATCH(number,name) AGAINST('0" . $decrypted_txtnew . "') GROUP BY name UNION SELECT id as 'id' ,name as 'name', number as 'number', ' ' as 'addrass' FROM list_numbers WHERE MATCH(number,name) AGAINST('20" . $decrypted_txtnew . "') GROUP BY name UNION SELECT id as 'id' ,name as 'name', number as 'number', ' ' as 'addrass' FROM list_numbers WHERE MATCH(number,name) AGAINST('0020" . $decrypted_txtnew . "') GROUP BY name "; $query1="SELECT numberphone as 'id' ,name as 'name', numberphone as 'number', addrass as 'addrass' FROM list_numbers WHERE MATCH(numberphone,name) AGAINST('20" . $decrypted_txtnew . "') GROUP BY name "; $query2="SELECT id as 'id' ,name as 'name', number as 'number', ' ' as 'addrass' FROM list_numbers WHERE MATCH(number,name) AGAINST('0020" . $decrypted_txtnew . "') AND codecoutnry='EG' GROUP BY name "; $startTime = time(); $result= mysqli_query($connecteg1, $query); $result1= mysqli_query($connecteg2, $query1); $result2= mysqli_query($connect2, $query2); if(! $result && ! $result1 && ! $result2 ) { die("Error in query");} //get data from database $output=array(); while($row= mysqli_fetch_assoc($result)) { $output[]=escapeJsonString($row); //$row['id'] } while($row2= mysqli_fetch_assoc($result2)) { $output[]=escapeJsonString($row2); } while($row1= mysqli_fetch_assoc($result1)) { $output[]=escapeJsonString($row1); } $endTime = time(); if ($output) { print( "{". "'info':'". json_encode($output) ."'}");// this will print the output in json } else{ print("error"); } function encrypt($wordEnc) { $key16 = substr("egbti23456122313", 0, 16); $key16Hex = unpack('H*', $key16); return openssl_encrypt($word, 'AES-128-CBC', $key16, 0, hex2bin($key16Hex[1])); } function decrypt($wordDec) { $key16 = substr("egbti23456122313", 0, 16); $key16Hex = unpack('H*', $key16); return openssl_decrypt($wordDec, "AES-128-CBC", $key16, 0, hex2bin($key16Hex[1])); } function escapeJsonString($value) { $escapers = array( "\"", '\'',"+"); $replacements = array(" ", " ",""); $result = str_replace($escapers, $replacements, $value); return $result; } // 4 clear mysqli_free_result($result); //5- close connection mysqli_close($connecteg1); ?>
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.15, 8.3.0 - 8.3.2
Warning: require(): open_basedir restriction in effect. File(DatabaseConfigegb1.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/KRVFT on line 3 Warning: require(DatabaseConfigegb1.php): Failed to open stream: Operation not permitted in /in/KRVFT on line 3 Fatal error: Uncaught Error: Failed opening required 'DatabaseConfigegb1.php' (include_path='.:') in /in/KRVFT:3 Stack trace: #0 {main} thrown in /in/KRVFT on line 3
Process exited with code 255.

preferences:
66.27 ms | 403 KiB | 52 Q