Ho uno script che a seguito dell'immissione di un URL mi effettua un check sul sito e mi registra in un log l'esito.
Il problema è che in Locale funziona correttamente, sul Hosting mi registra due volte i dati, ma non duplicati, sono proprio due esecuzioni differenti.
Cosa può essere che mi genera due volte l'esecuzione dello script?
Codice PHP:
<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];if(isset($_POST['sito_url'])){ $sito_url=$_POST['sito_url'];} else $sito_url='';//if(isset($_POST['pbconferma'])){ $pbconferma=$_POST['pbconferma'];} else $pbconferma='';
$pbconferma=f_controllo_campi($pbconferma);$sito_url=f_controllo_campi($sito_url);
$setta_percorso_img = str_replace("tool","immagini",$url);
if (strpos(trim($sito_url), 'http://')===false)$sito_url='http://'.$sito_url;
if (substr($setta_percorso_img, -1)=="/" )$setta_percorso_img=substr($setta_percorso_img, 0,strlen($setta_percorso_img) -1);
echo "<form name='form' method='post' action=''>";echo "Url da Verificare: <input type='text' name='sito_url' value='$sito_url'>";
echo "<input type='submit' class='btn btn-primary' name='pbconferma' value=' Conferma ' >";echo "</form>";
if (($sito_url!="")&&($sito_url!="http://")){list($Risultato, $Val_http, $Val_time) = ControlloSito($sito_url);
// Visualizzo Dati
echo "<table>";echo "<tr> <td style='width: 25%;'> <h6> Stato Sito </h6> </td>"; if ($Risultato=="OK") echo "<td style='width: 25%;'> <img src=$setta_percorso_img/verde.png height='25' width='25'> </td> ";else echo "<td style='width: 25%;'> <img src=$setta_percorso_img/rosso.png height='25' width='25'> </td> "; echo "<td style='width: 25%;'> <h6> Tempo Risposta </h6> </td> <td style='width: 25%;'> <h6> $Val_time s</h6> </td> </tr>"; echo "</table>";
// Inserisco dato in tabella LOG
$sql_ins = mysql_query("INSERT INTO sito_stato (data, sito_url, sito_stato, sito_time) VALUES (now(), '$sito_url', '$Risultato', '$Val_time')") or die ('Error00: '.mysql_error ());
}
?>