simple way to make cookie

i need to understand a way to make cookie for my site

i have index and some pages need permission in the same directory and a folder need permission

please help
AHMED SAMYownerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ganesh GuruduSenior ConsultantCommented:
Cookies are data, stored in small text files, on your computer.

When a web server has sent a web page to a browser, the connection is shut down, and the server forgets everything about the user.

Cookies were invented to solve the problem "how to remember information about the user":

When a user visits a web page, his name can be stored in a cookie.
Next time the user visits the page, the cookie "remembers" his name.
Cookies are saved in name-value pairs like:

username = John Doe

for more information check below URL.
AHMED SAMYownerAuthor Commented:
ok  i have cookie file

when i set logout resend me again to the site and welcome my name
AHMED SAMYownerAuthor Commented:
again now i make a condition when he logout send value any thing for example 1

i index when he tries auto to login check value when it is exists not login and make session

right now i have problem

when close browser and open again go website logain again although i made sign out how i solve it
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

AHMED SAMYownerAuthor Commented:
please help
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
System's like WordPress do this really well.

To recreate content protection as well as WordPress, you'll have to rewrite equivalent code.

Best to just use WordPress. This will give you instant content protection (where you require it) + also session management, so you can focus on creating + marketing yourcontent.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AHMED SAMYownerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.