我想使用session_id或用戶信息從另一個php文件更新會話變量。假設用戶已登錄(會話已打開)。 還有另一個名爲receive_notification.php 的文件,它接收來自移動應用程序的http請求並從中獲取數據。我試圖將這些數據包含在用戶的MemberPage中。編輯會話使用session_id或用戶信息
//receives location updates from the app
<?php
require 'database.php';
require 'model.php';
if(isset($_POST["IMEI"])){
//collect data
$imei = filter_input(INPUT_POST, 'IMEI');
$SessionID = filter_input(INPUT_POST, 'Sessionid');
$latitude = filter_input(INPUT_POST, 'Lat');
$longitude = filter_input(INPUT_POST, 'Long');
if(!isset($_SESSION)){
session_id($SessionID);
session_start();
}
//gets phone id
$phoneid = getphoneIdByIMEI($imei);
//gets user's (firstname, lastname, email)
$user = getUserByPhoneID($phoneid);
//echo $latitude ." ".$longtitude;
//trying to update specific user's MemberPage and
//display $latitude and $longtitude
include('../MemberPage.php');
}else {echo "nothing";}
?>
我試圖獲取用戶,包括$緯度和經度$在他的會議,但是當我試圖呼應他們,他們在MemberPage.php不確定的。我現在想弄清楚這件事。有人能告訴我如何找到特定的用戶並將這些數據包含在會話中嗎?
include('../ MemberPage.php');這行寫在頂部 –