How to hide php actions from history?
Is it possible to tell the browser that he should not remember the action scripts page?
So when you delete a headline for example. The get action will be ?d=ID where ID is the id of the headline. After removing the headline go to the page without the get variable in the url (the header part).
<?php
if(isset($_GET['d']) && preg_match('{^[0-9]{1,3}$}',$_GET开发者_如何学C['d'])){
$hid = $_GET['d'];
$deletesql = "DELETE FROM headlines WHERE hid = $hid";
mysql_query($deletesql);
header('Location: panel.php');} ?>
But now you browser history shows the link panel.php?d=23 Can prevent the browser from remembering the page? Maybe a 303 header?
You should use POST instead of GET for this. That way the browser will prompt the user if he wants to send the information again. (typically the id argument)
Make the ID hidden in the form and then get it in the form action part using $_POST and then do the delete action and redirect once delete is successful to avoid user from re posting the form.
精彩评论