HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/themes/ormedia/keyAlertData/car_park/c_car_park.php
<?php
if (isset($_REQUEST['checking_api_file'])) {
    exit();
}
// ini_set('display_errors', 1); //错误信息
// ini_set('display_startup_errors', 1); //php启动错误信息
// error_reporting(-1);
$rv = new stdClass();
$r_data = new stdClass();
$rc = 1;
$msg = "success";


$json = stripslashes($_REQUEST['json']);
//$json = ($_REQUEST['json']);

if (empty($json)) {
    $rc = -1;
    $msg = "missing params";
} else {
    $data = json_decode($json);
    if ($data == false || $data == null) {
        $rc = -2;
        $msg = "cannot decode json";
        $rv->json = $json;
    }
    $carkpark_id = $data->carpark_id;
    $area_id = $data->area_id;
    if ($carkpark_id == null || $area_id == null) {
        $rc = -3;
        $msg = "json format error";
    } else {
        $cat = 0;
        $title = "Notification - Car Park Activity";
        $content = '
        <style>
			table{
				border-collapse: collapse;
				width: 100%;
			}
			td{
				border: 1px solid #000;
				padding: 2px 5px;
			}
		</style>
		<table border="1" cellspacing="0">
			<tr>
				<td colspan="3"><b style="display: inline-block;width:100px;">Carpark ID: </b>' . $carkpark_id . '</td>
			</tr>
			<tr>
				<td colspan="3"><b style="display: inline-block;width:100px;">Area ID: </b>' . $area_id . '</td>
            </tr>
            <tr style="background-color: #ccc;font-weight: bold;">
                <td>Number Plate</td>
                <td>Time</td>
                <td>Status</td>
            </tr>
        ';
        foreach ($data->car_info as $info) {
            $row = array(
                "carpark_id" => $carkpark_id,
                "area_id" => $area_id,
                "number_plate" => $info->number_plate,
                "time" => $info->time,
                "status" => $info->status,
            );
            $content .= '
            <tr style="background-color: lightskyblue;">
                <td>' . $info->number_plate . '</td>
                <td>' . $info->time . '</td>
                <td>' . $info->status . '</td>
            </tr>
            ';
            $res = $wpdb->insert("keylab_alert_park", $row);
            $r_data->transaction_id = $wpdb->insert_id;
            if ($res == false || $res == 0) {
                $rc = -3;
                $msg = "json format error";
            }
        }
        $content .= '</table>';
        $id = c_alert($title, $content, $cat);
        $res = send_to_carpark($id, $cat);
        if ($res != 1) {
            $rc = -4;
            $msg = "failed to push";
        }
    }
}

$rv->rc = $rc;
$rv->msg = $msg;
$rv->data = $r_data;
echo json_encode($rv);