0

I have installed two different PHP scripts on my server. One on root and another on different sub-directory. However, I want the root phpscript's users session to be continued on another sub-directory script. I need this session to enable chat even on another directory script.

The sub directory is os-class. I made a different PHP file on sub-directory to track session variables.

Array ( [user_email] => [email protected]
        [users_id] => 275
        [first_name] => Sammy
        [last_name] => Durha
        [username] => 275
        [mobile] => XXXXXXXXX
        [chat_sms_sent] => message sent to off line friends. )

However on one of the script page the half session gets lost.

Array ( [messages] => Array ( )
        [keepForm] => Array ( )
        [form] => Array ( )
        [chat_sms_sent] => message sent to off line friends. )

Can anyone please sort out the problem.

Thanks

2 Answers 2

1

Sessions are not tied to a directory. If you call session_start() at the top of both scripts, the $_SESSION variable should have the same content in both.

Sign up to request clarification or add additional context in comments.

1 Comment

but why session [user_email] => [email protected] [users_id] => 275 [first_name] => Sammy [last_name] => Durha [username] => 275 [mobile] are lost when session_start is called on new script?
0

Session is independent of directories and files. It can be used universally. But remember that sessions are less secure.

You may follow a simple tutorial here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.