destroy session php
<?php
session_start(); // start session
session_destroy(); // Delete whole session
// OR
unset($_SESSION['username']); // delete any specific session only
?>
destroy session php
<?php
session_start(); // start session
session_destroy(); // Delete whole session
// OR
unset($_SESSION['username']); // delete any specific session only
?>
php sessions
<?php
// Start new or resume existing session.
session_start();
// Add values to the session.
$_SESSION['item_name'] = 'value'; // string
$_SESSION['item_name'] = 0; // int
$_SESSION['item_name'] = 0.0; // float
// Get session values.
$value = $_SESSION['item_name'];
?>
php cookies
//Cookies
//Cookies are stored on the client side. cookies are not as secure as sessions
//and it is recommended that you use sessions as much as possible.
<?php
if(isset($_POST['submit'])){
$username = htmlentities($_POST['username']);
setcookie('nameofcookie', $username, time()+3600);
//1hour time limit
header('Location: page2.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Cookies</title>
</head>
<body>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="text" name="username" placeholder="Enter Username">
<br>
<input type="submit" name="submit" value="Submit">
</form>
</div>
</body>
</html>
php cookie
setcookie ('name', 'value', $expiresOn, $path, $domain, $secure, $httponly)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us