为了账号安全,请及时绑定邮箱和手机立即绑定

processForm.php为我的会话ID提供了零值

processForm.php为我的会话ID提供了零值

PHP
潇湘沐 2021-05-13 10:12:22
我想从另一个表中存储数据(id,profile_image,标题)(我只是下载用于上传图像的代码)问题是当我要保存数据时,processForm.php始终为我提供Session ID的零值,我当前的ID是“ 1”。我是这里的新手。(login.php)    <?php    // Initialize the session    session_start();    // Check if the user is already logged in, if yes then redirect him to     welcome page    if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){    header("location: welcome.php");    exit;    }    // Include config file    require_once "config.php";    // Define variables and initialize with empty values    $username = $password = "";    $username_err = $password_err = "";    // Processing form data when form is submitted    if($_SERVER["REQUEST_METHOD"] == "POST"){    // Check if username is empty    if(empty(trim($_POST["username"]))){    $username_err = "Please enter username.";    } else{    $username = trim($_POST["username"]);    }    // Check if password is empty    if(empty(trim($_POST["password"]))){    $password_err = "Please enter your password.";    } else{    $password = trim($_POST["password"]);    }    // Validate credentials    if(empty($username_err) && empty($password_err)){    // Prepare a select statement    $sql = "SELECT id, username, password FROM users WHERE username = ?";    if($stmt = mysqli_prepare($link, $sql)){        // Bind variables to the prepared statement as parameters        mysqli_stmt_bind_param($stmt, "s", $param_username);        // Set parameters        $param_username = $username;      
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 137 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信