SESSION IN WEB PRESENTED BY, MD RAHEDUL ISLAM ID:180107 WHAT IS SESSION • The amount of time that a user spends engaged in a particular activity. • Way to store information (in variables) to be used across multiple pages. • The moment they arrive on the first page, to the moment they leave the site. WHY DO WE USE IT? • HTTP is StateLess. • Application would not be able to remember user-specific information . • Keep track of information . • To store important information securely (id,password). • Authentication , Form submission(multipage) , Shopping cart contents . • The user navigates between different pages of the application . HOW DOES IT WORK SESSION VARIABLES $_SESSION[‘UserName’]=‘Rupok’; $_SESSION[‘Password’]=‘1234’; $_SESSION[‘time’]=time(); $_SESSION[‘cart’]=“$number”; SESSION VS COOKIE SESSION COOKIE • Server-side files • Client-side files • Ends when a user closes his browser • Depending on the lifetime you set • Dependent on Cookie • Cookie is not dependent on Session • Save the user’s data in encrypted form • Save the user’s data in a text file DISADVANTAGES • Server resources(high traffic website). • Scalability(large number of simultaneous sessions). • Security risks(Hijacking) • User experience(Expires unexpectedly). THANK YOU! rahedul0176@gmail.com