PHP sessions

Home » Tutorials » PHP » PHP sessions
Today we will discuss sessions in php. It helps browser to identify user in different pages.
We will apply session in our web application. First of all we call session_start function, which starts session. It is very important, that this function must be called before any output in browser. We’ll create authorization form and new table in our database to store data about users.

Next we’ll write function, which will check user with input data from html form. If it is check, we’ll record login into global array $_SESSION, announcing the key, which we can identify login.

That’s all. We only need to call session_start() function in other pages.

What’s happening, when you logout from account in any web site? Session destroys. We created logout.php file, where after starting session we call session_destroy() function, which delete session.


Submit a Comment

Your email address will not be published. Required fields are marked *

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This