Micheal
Micheal

Reputation: 2322

does session_name create a cookie

Does session_name set cookies as well?

session_name("sess");
session_start();

if I add this line of code "sess" shows up in the cookies. Why is that?

Can I make it secure without using the setcookie function?

NOTE: "sess" is not set as a cookie anywhere. So my question is why does it show up as a cookie in firebug.

Upvotes: 0

Views: 628

Answers (1)

dchayka
dchayka

Reputation: 1302

According to PHP's manual, session_name() function returns the current name of the session. If you provide a name (like you did, "sess") it will change the session's name while returning previous session name to your variable.

Given their description, the session name is used to name the cookie file to identify your cookie. That's why PHP manual recommends using letters and numbers only while keeping the name very short.

Upvotes: 1

Related Questions