2017-03-08 109 views
1

我想使用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不確定的。我現在想弄清楚這件事。有人能告訴我如何找到特定的用戶並將這些數據包含在會話中嗎?

+0

include('../ MemberPage.php');這行寫在頂部 –

回答

0

檢查MemberPage.php頁面,它有任何語法錯誤或您是否能夠打印MemberPage.php頁面的任何數據。

嘗試檢查包含路徑並將包含文件移動到頁面頂部。

+0

MemberPage作品完美我可以回顯所有的用戶信息(名字姓氏電子郵件)。唯一的問題是,當我嘗試打印經度和緯度。他們不被認可。 –