My sessions suddenly stopped working!

Username (e.g. epiz_XXX) or Website URL

Username: epiz_32244887 website:
(use Test as username and 123 as password for testing)

Other Information

Until a few weeks ago the site was working perfectly and now it just stopped!
so I made some changes so that after login the site informed me the username that would be saved in a Session and that’s when I noticed that it was no longer storing the sessions!

so what can i do?

the codes

login.php

verificar.php
image

Maybe sistem secure changing.
Uhm. Can you test my verificar.php. what the output

<?php
    session_start();
   
   if (!empty($_SESSION["fileId"])) {
        echo "fileId: " . $_SESSION["fileId"];
    } else {
        echo "none() " . time();
        
        $servername = 'xxx';
    $dbname = 'xxxxxx';
    $username = 'xxxxxxx';
    $password = 'xxxxxx';
    
      try {
      	  $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $sql = "INSERT INTO pesanan (username, status, items)
               VALUES ('John', 'Doe', '[email protected]')"; ///change insert
            // use exec() because no results are returned
            $conn->exec($sql);
            $last_id = $conn->lastInsertId();
            $result_getkey = $last_id;
            echo "sesi start: " . $last_id;
            $_SESSION["fileId"] = $result_getkey;
           
         }
       catch(PDOException $e)
         {
            //echo $e;
            echo "not connected!";
         }

        $conn = null;
    };
    
    
?>

maybe your mysqli doesn’t working anymore. I mean can you set session simply. And verificar your session.xD . Many system reject mysqli.
Just maybe.
Yes, Test 123 does not show the result. ← i thoght session value unreadable with redirect like tat. Did you play me??

Hello

There was a temporary server error that affected sessions, but it seemed to have been resolved. It is possible that you account is still affected however.

Your code does seem to be correct, so you don’t need to change it.

Can you open the control panel, select “Alter PHP Config”, and enable “Display Errors”?

When you use your website, if any errors appear, please copy them here. Make sure to turn “Display PHP Errors” back off again when you are done.

8 Likes

First of all thanks! i didnt know you could enable the errors!

and yea, my account still glitched ;p
here what appears

Hm, that is the same error that was seen before by others users, it’s caused by something gone wrong on the server end.

Admin will be able to provide more information when he comes online.

7 Likes

i found a solution using this

" Steps to solution

create folder tmp inside of the website root

change permission to 777

sudo chmod -R 777 tmp

enter this line above session_start() in your code

ini_set(‘session.save_path’, ‘/tmp’);"

idk if this gonna cause any problem(so i dont want to close the topic) but now the session works again :slight_smile:

7 Likes

If anyone is wondering how to change the CHMOD on InfinityFree:

FileZilla

After connecting to FTP, right-click on the folder and select the “File permissions…” option.
image
Then, you can select all boxes or type in 777.
image
Click on OK to confirm.

File Manager

On the File Manager, right-click the folder (or click the arrow button) and select CHMOD.
image
Then, you can check all checkboxes or type-in 777 and click on OK to confirm.

7 Likes

Quite similar to this as well

4 Likes

nice one. i wondering what is echo realpath(dirname($_SERVER[‘DOCUMENT_ROOT’])
we playing pool 9 ball. I just hoping it is ball-9. Because no matter it is ball-2. This group is great.

I’ve worked with iFastNet to fix this issue and it seems the issue has been resolved now! You should able to use PHP sessions again with the default settings.

7 Likes

yea! is working! finally
now i just need to remove the iniset from my website xD

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.