3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @file requestUserInfo.php * @TIME * @brief Brief * @Author Author * @Website www.lotto-pass.cn * */ define('IN_ECS', true); //echo "<p>in request:"; //print_r($_POST); $current_path = dirname(__FILE__); $base_path = substr($current_path, 0, strlen($current_path) - strlen("/webservice")); require_once($base_path . '/includes/init.php'); require_once(ROOT_PATH . 'includes/cls_json.php'); require_once(ROOT_PATH . 'includes/lib_common.php'); // echo "<p>After include:"; require_once (ROOT_PATH . 'includes/utilities/dbutilities.php'); require_once (ROOT_PATH . 'includes/webservice/webserviceutilities.php'); require_once (ROOT_PATH . 'includes/utilities/userUtilities.php'); $device_id = getHttpRequest("device_id"); $trans_time = getHttpRequest("trans_time"); $card_number = getHttpRequest("card_number"); $sessionId = getHttpRequest("sessionId"); $sessionTime = getHttpRequest("sessionTime"); $min_required_points = getHttpRequest("mpb"); $check_sum = getHttpRequest("checksum"); $check_sum_array = array( "device_id" => $device_id, "trans_time" => $trans_time, "card_number" => $card_number, "sessionId" => $sessionId, "sessionTime" => $sessionTime, "mpb" => $min_required_points, "checksum" => $check_sum ); $check_sum_str = constructHttpParameters($check_sum_array); $resultcode = 0; $xml_string = ""; $update_data = array(); $log_date = array(); $post_data = array(); $min_factor1=5; //最低积分的倍数; $min_factor2=10; $transfer_factor1 = 0; // Not enough, no transfer $transfer_factor2 = 1; // Very low, send everything that enough for purchase $transfer_factor3 = 2; // Not enough for 10 purchases, send half of the points $transfer_factor4 = 10; // Sufficient, send points for 10 purchases. $exist_card_number = 0; $post_data['sessionId'] = $sessionId; $post_data['device_id'] = $device_id; $post_data['trans_time'] = $trans_time; $post_data['mpb'] = $min_required_points; $post_data['user_id'] = ""; $post_data['user_name'] = ""; $post_data['alias'] = "";//urlencode($alias); $post_data['display_user_points'] = 0; $post_data['message'] = ""; $post_data['transfer_points'] = 0; $post_data['user_points'] = 0; $post_data['fund_status'] = 100; //100 means not enough fund // Retrieve the jackpot related information and messages $jackpot_table_name = "jackpot_award"; $jackpot_key = "add_time"; $jackpot_sql_result = selectLastRecord($jackpot_key, $jackpot_table_name); while($sql_data = mysql_fetch_array($jackpot_sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $jackpot_amount = $sql_data['jackpot_amount']; $jackpot_ceiling = $sql_data['jackpot_ceiling']; $jackpot_preserved = $sql_data['jackpot_preserved']; $message_front = $sql_data['message_front']; $message_mid = $sql_data['message_mid']; $message_end = $sql_data['message_end']; $message_top = $sql_data['message_top']; //echo "The messages:".$message_front."-".$message_mid."-".$message_end."-".$message_top; $jackpot_data['jackpot_amount'] = $jackpot_amount; $jackpot_data['jackpot_ceiling'] = $jackpot_ceiling; $jackpot_data['jackpot_preserved'] = $jackpot_preserved; $jackpot_data['message_front'] = $message_front; $jackpot_data['message_mid'] = $message_mid; $jackpot_data['message_end'] = $message_end; $jackpot_data['message_top'] = $message_top; $post_data['Jackpot'] = $jackpot_data; } mysql_free_result($sql_result); // echo "<p>The post data:"; // print_r($post_data); if (checkBcc($check_sum_str, $check_sum)) { if (!existSessionId($sessionId, $sessionTime)) { // Retrieve the user information and the points from database $table_name = "users"; $conditions = "card_number = ".$card_number; $sql_result = selectConditionalRecords($conditions, $table_name); while($sql_data = mysql_fetch_array($sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $exist_card_number++; $user_id = $sql_data['user_id']; $user_name = $sql_data['user_name']; $alias = $sql_data['alias']; $current_user_points = abs($sql_data['user_points']); $current_frozen_points = abs($sql_data['frozen_points']); $post_data['user_id'] = $user_id; $post_data['user_name'] = $user_name; $post_data['alias'] = $alias; $post_data['display_user_points'] = abs(intval($current_user_points)); $usable_points = $current_user_points - $current_frozen_points; // echo "<p>usable_points:".$usable_points; switch ($usable_points) { case ($usable_points < $min_required_points) : // echo "<p>case: 100"; $post_data['message'] = "剩余积分不足, 请充值后再继续。"; //$usable_points = 0; $transfer_points = $usable_points * $transfer_factor1; $user_points = $current_user_points; $frozen_points = $current_frozen_points + $transfer_points; $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 100; //100 means not enough fund break; case ($usable_points >= $min_required_points and $usable_points <= $min_required_points*$min_factor1) : // echo "<p>case: 200"; $post_data['message'] = "剩余积分很低,请速充值。"; $transfer_points = round($usable_points/($min_required_points * $transfer_factor2),0)*$min_required_points; while ($transfer_points > $usable_points) { $transfer_points = $transfer_points - $min_required_points; } $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 200; //200 means very low fund break; case ($usable_points > $min_required_points*$min_factor1 and $usable_points <= $min_required_points*$min_factor2) : // echo "<p>case: 300"; $post_data['message'] = "剩余积分低,请速充值。"; $transfer_points = round($usable_points /($min_required_points * $transfer_factor3),0)*$min_required_points; while ($transfer_points > $usable_points) { $transfer_points = $transfer_points - $min_required_points; } $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 300; //300 means low fund break; case ($usable_points >= $min_required_points*$min_factor4) : // echo "<p>case: default"; $post_data['message'] = "感谢参与公益购彩。"; $transfer_points = $min_required_points*$transfer_factor4; $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 1000; //1000 means sufficient fund break; default : // echo "<p>case: 0"; $post_data['message'] = "无法获取有效积分,请重试。"; $usable_points = 0; $transfer_points = 0; $user_points = 0; $post_data['transfer_points'] = 0; $post_data['user_points'] = 0; $post_data['fund_status'] = 0; //0 means not processed } } mysql_free_result($sql_result); // print_r($post_data); // Update if ($exist_card_number > 0) { $post_data['card_number'] = $card_number; $user_point_change = - $transfer_points; $frozen_points_change = $transfer_points; $change_desc = "可用积分".$usable_points.",向".$device_id."上划拨".$frozen_points."积分,资金状态".$post_data['fund_status']; log_account_change($user_id, 0, 0, 0, $user_point_change, $frozen_points_change, 0, 0, $change_desc); $resultcode = 1; $post_data['status'] = $resultcode; // Check if there is any voucher need to be printed for this user. $voucher_table_name = "active_vouchers"; $conditions = "user_id = ".$user_id." AND status = 0"; $voucher_sql_result = selectConditionalRecords($conditions, $voucher_table_name);; while($sql_data = mysql_fetch_array($voucher_sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $voucher_id = $sql_data['id']; $voucher_template_id = $sql_data['voucher_id']; $qr_message = $sql_data['qr_message']; $voucher_message = $sql_data['message']; $voucher_data['voucher_id'] = $voucher_id; $voucher_data['voucher_template_id'] = $voucher_template_id; $voucher_data['qr_message'] = $qr_message; $voucher_data['voucher_message'] = $voucher_message; $post_data['Coupon'] = $voucher_data; } mysql_free_result($sql_result); } else { $post_data['card_number'] = -1; } $xml_string = getArrayToXML($post_data); //echo $xml_string; $dbStatus = setSessionId($sessionId, $sessionTime, $frozen_points, $xml_string); // echo "<p> The XML_data:".$xml_string; } else { $resultcode = 2;//重发 $xml_string = getTransferred($sessionId, $sessionTime); } } else { $resultcode = 0; } header("Expires: date('Y-m-d H:i:s')"); echo $xml_string; ?>
Output for 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: require_once(): open_basedir restriction in effect. File(/includes/init.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/LMePG on line 17 Warning: require_once(/includes/init.php): Failed to open stream: Operation not permitted in /in/LMePG on line 17 Fatal error: Uncaught Error: Failed opening required '/includes/init.php' (include_path='.:') in /in/LMePG:17 Stack trace: #0 {main} thrown in /in/LMePG on line 17
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: require_once(): open_basedir restriction in effect. File(/includes/init.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/LMePG on line 17 Warning: require_once(/includes/init.php): Failed to open stream: Operation not permitted in /in/LMePG on line 17 Fatal error: Uncaught Error: Failed opening required '/includes/init.php' (include_path='.:') in /in/LMePG:17 Stack trace: #0 {main} thrown in /in/LMePG on line 17
Process exited with code 255.
Output for 8.0.0 - 8.0.13
Warning: require_once(/includes/init.php): Failed to open stream: No such file or directory in /in/LMePG on line 17 Fatal error: Uncaught Error: Failed opening required '/includes/init.php' (include_path='.:') in /in/LMePG:17 Stack trace: #0 {main} thrown in /in/LMePG on line 17
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25, 7.4.33
Warning: require_once(/includes/init.php): failed to open stream: No such file or directory in /in/LMePG on line 17 Fatal error: require_once(): Failed opening required '/includes/init.php' (include_path='.:') in /in/LMePG on line 17
Process exited with code 255.
Output for 7.4.26 - 7.4.32
Warning: require_once(): open_basedir restriction in effect. File(/includes/init.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/LMePG on line 17 Warning: require_once(/includes/init.php): failed to open stream: Operation not permitted in /in/LMePG on line 17 Fatal error: require_once(): Failed opening required '/includes/init.php' (include_path='.:') in /in/LMePG on line 17
Process exited with code 255.

preferences:
250.86 ms | 402 KiB | 385 Q