简体   繁体   中英

PHP doesn't create session

After check, that's the problem actually:

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current   setting of session.save_path is correct (/mnt/ramdisk) in Unknown on line 0

Add session_start() in the beginning of your code like this, and see if it helps.

session_start();
$file = fopen($path, "r");
        if($file) 
        {
            if(isSet($_POST['login']))
            {
                while(($line = fgets($file)) !== false) 
                {
                    $user_data=explode(";", $line);

                    if($_POST['login']==trim($user_data[0]))
                    {
                        if(md5($_POST['pass'])==trim($user_data[1]))
                        {
                            $_SESSION['logged']=htmlspecialchars($_POST['login']);
                            header('Location:vms.php');
                            break;
                        }
                    }
                }
                echo "
                        <script>
                            alert('Invalid login or password');
                        </script>
                    ";
            }
        } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM