سلام دوستان.
من یه مشکلی که خیلی وقته دارم وقتی صفحه رو رفرش میکنم سشن پاک میشه.
این کد هامه:
<?php
session_start();if (isset($_SESSION['login_user']))
echo "session:".$_SESSION['login_user'] ;if (empty($_POST['useame']) || empty($_POST['password'])) {
$error = "Useame or Password is invalid";
}
else
{
$useame=$_POST['useame'];
$password=$_POST['password'];
$_SESSION['login_user']=$useame;
header("location: profile.php");
}?>
<!DOCTYPE html>
<html>
<head>
<title>Login Form in PHP with Session</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="main">
<h1>PHP Login Session Example</h1>
<div id="login">
<h2>Login Form</h2>
<form action="" method="post">
<label>UserName :</label>
<input id="name" name="useame" placeholder="useame" type="text">
<label>Password :</label>
<input id="password" name="password" placeholder="**********" type="password">
<input name="submit" type="submit" value=" Login ">
</form>
</div>
</div>
</body>
</html>
برچسب:
نویسنده: محمد رضا جوادیان