PHP会话的用户ID

时间:2017-04-29 22:32:55

标签: php mysql session

如何使用PHP(会话)填写表单时保存用户ID?我的意思是如何获得此会话并编写SQL查询以保存已提交的表单中的uder ID ...

这是我的会议

session_start();
$_SESSION['user_id'] = $data['user_id'];
$_SESSION['first_name'] = $data['first_name'];

此时用户登录以填写表单

session_start();
if (!isset($_SESSION['agent']) OR ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT']) )) {
    // Need the functions:
    require ('includes/login_functions.inc.php');
    redirect_user();
    // Print a message:
}
echo "<span>You are now logged in, {$_SESSION['first_name']}!<a href=\"logout.php\">Logout</a></p></span>";

0 个答案:

没有答案