Tuesday, 9 June 2020

unsetting php session

unsetting php session
set.php
<?php
if this is set means it is executed in browse window means it is opened in browser window
session_start();
$_SESSION['name'] = 'rafique';
?>
zoom .pjp
<?php
if set page is not opnened, then if u open this page, it shows error
session_start();
echo = $_SESSION['user'];
if u opened after the set page, it will print name
?>
view.php
<?php
if u opened before set page, it wil show please login, if u open this page after set page, it shows name
session_start();

if(isset ($_SESSION['user'])){
if session page is opened, it will print welcome rafique, if its not set page opneed, it will print log in
echo 'welcome, '.$_SESSION['user'];
} else {
echo 'please log in!';
}
?>
unset
<?php
session_start();
Like include
unset($_SESSION['USER']);
if u opened, then data in browser is deleted, u have to new session, means after this page, any view or zoom page opened, it shwos some error
?>
echo 'welcome, '.$_SESSION['user']. '!';
set.php
<?php
session_start();
$_SESSION['user'] = 'saneer';
after this page open, if u openn the view page , the values shown
$_SESSION['pass'] = '123123';
?>
<?php
session_start();

if(isset ($_SESSION['user'])){
it will print that values in display if u open that set sessions page
echo 'welcome, '.$_SESSION['user'] .'!<br><br> passowrd: '>$_SESSION['pass'];
} else {
sameer
echo 'please log in!';
123123
}
?>
unset only one
<?php
session_start();
we unset only user
unset($_SESSION['USER']);
its not all
?>
at atime unset all
<?php
session_start();
session_destroy();
it will remove all the sessions
?>












session_start();
$_SESSION['name'] 
session_start();
session_start();
$_SESSION['name'] 
if
else
unset
$_SESSION['name'] 
cocnatenation
session_start();
$_SESSION['USER']
session_start();
isset
session_start();
unset
session_destroy


how can we store the cookies in browser
canw e opne before set page,if opened what happened
how to print the data in session page
how to print the data in session page, if that page is set otherwise printsomethinh
how to print the data in session page, if that page is set otherwise printsomethinh
how to remove the data from browser
how to give another two values to set page
how to view the username and password after session page open
how to unset all the thing using normal unset,is it possible
how to unset all sessions?


No comments:

Post a Comment