我有这个代码,需要代码来添加一个注销按钮,任何人都可以写出一个注销用户的注销按钮的代码,我读了一些关于销毁会话但不知道如何写出代码的东西,谢谢你!
<?php
include 'connection.php';
//start of checking if user is logged in code
if (!valid_credentials) {
header('Location: login.php');
exit();
}
$_SESSION['user'] = 'username';
if (!isset($_SESSION['user'])) {
header('Location: login.php');
exit();
}
//end of logged in code and starting a session
$query = "SELECT * FROM people";
$result = mysql_query($query);
While($person = mysql_fetch_array($result)) {
echo "<h3>" . $person['Name'] . "</h3>";
echo "<p>" . $person['Description'] . "</p>";
echo "<a href=\"modify.php?id=" . $person['ID']. "\">Modify User</a>";
echo "<span> </span>";
echo "<a href=\"delete.php?id=" . $person['ID']. "\">Delete User</a>";
}
?>
<h1>Create a User</h1>
<form action="create.php" method="post">
Name<input type ="text" name="inputName" value="" /><br />
Description<input type ="text" name="inputDesc" value="" />
<br />
<input type="submit" name="submit" />
</form>