ciao a tutti,
qualcuno mi sa dire come posso bloccare i doppi invii, causa refreash pagina ecc ecc con <?php echo $_SERVER['PHP_SELF']; ?>
qualcuno mi sa dire come posso bloccare i doppi invii, causa refreash pagina ecc ecc con <?php echo $_SERVER['PHP_SELF']; ?>
PHP:
<?php
include 'dbc.php';
page_protect();
?>
<html>
<head>
<title>My Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="160" valign="top">
<?php
/*********************** MYACCOUNT MENU ****************************
This code shows my account menu only to logged in users.
Copy this code till END and place it in a new html or php where
you want to show myaccount options. This is only visible to logged in users
*******************************************************************/
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
<p><strong>My Account</strong></p>
<a href="myaccount.php">My Account</a><br>
<a href="mysettings.php">Settings</a><br>
<a href="logout.php">Logout </a>
<p>You can add more links here for users</p></div>
<?php }
if (checkAdmin()) {
/*******************************END**************************/
?>
<p> <a href="admin.php">Admin CP </a></p>
<?php } ?>
<p> </p>
<p> </p>
<p> </p></td>
<td width="732" valign="top"><p> </p>
<h3 class="titlehdr">Welcome <?php echo $_SESSION['user_name'];?></h3>
<?php
if (isset($_GET['msg'])) {
echo "<div class=\"error\">$_GET[msg]</div>";
}
?>
<p>This is the my account page</p>
<a href="accetta.php" />Controlla se hai richieste d'amicizia</a>
<br />
<br />
<br />
<?php echo $_SESSION['user_id'];
require ("db_connect.php");
$user_id = $_POST['user_id'];
$commento=$_POST["commento"];
$commento=ereg_replace("\n","<br>",$commento);
if(get_magic_quotes_gpc()) {
$commento=stripslashes($commento);
}
$commento =mysql_real_escape_string($commento);
$insert = mysql_query("INSERT INTO annunci SET
commento='$commento', user_id=".$_SESSION['user_id']."");
?>
<div class="content">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>
<label for="commento"></label>
<textarea name="commento" id="commento" cols="55" rows="20"></textarea>
</p>
<p>
<input type="submit" name="submit" id="submit" value="Invia Commento" />
</p>
</form>
</div>
<?php
require ("db_connect.php");
$result = mysql_query("SELECT * FROM annunci, users WHERE user_id=".$_SESSION['user_id']. " AND user_id=users.id
");
//recuperiamo i dati da stampare
while ($records = mysql_fetch_array($result)) {
$commento = $records['commento'];
$user_name = $records['user_name'];
$ts = $records['ts'];
echo "<a href=\"myprofile.php?user_name=$user_name\">$user_name</a>";
echo "<h2> <img src='immagini/.gif' width='30' height='50' /> $user_name</h2> ";
echo "<h6>$commento</h6> ";
echo "<h6>$ts</h6> ";
}
?>
</td>
<td width="196" valign="top"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table>
</body>
</html>