user3233161
user3233161

Reputation: 1

PHP sessions and previous dir

I have catalog named "scripts"(PATH: /home/olo/www/site/scripts). In this catalog i have file called "login.php". This file create SESSION after user login. I have file called "index.php"(PATH: /home/olo/www/site). My SESSIONS created in "scripts" don't work in "index.php". It showed me, that SESSION isn't set. Can anybody help me ? Thanks a lot.

Upvotes: 0

Views: 38

Answers (2)

sush
sush

Reputation: 52

You must start session in every page after login

try to add this code at the top of your index.php file

<?php
     session_start();
?>

Upvotes: 1

Wottensprels
Wottensprels

Reputation: 3327

Your session isn't restored. You'll have to call session_start()

See: PHP docs

session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

Upvotes: 0

Related Questions