@ Considerazione personale @
Avere una pagina che fa da cuore sql secondo me lo rende più gestibile in qunto tramite GET richiami il caso che vuoi ecco un esempio :
link ---> sql.php?fare=cancella_utente
nella pagina tu hai una serie di if tipo...
Codice PHP:
if($_GET['fare']=='inserisci_utente')
{
$uid = $_GET['uid'];
$ip = $_SERVER['REMOTE_ADDR'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$host = $_SERVER['HTTP_HOST'];
$url = $_SERVER['REQUEST_URI'];
$time = time();
$sql= "SELECT * FROM tbl_stats WHERE lg_id = $uid";
$query = mysql_query($sql) or die (mysql_error());
$result = mysql_fetch_assoc($query);
$numrows = mysql_num_rows($query);
echo $numrows;
if($numrows == 0)
{
$sql = "INSERT INTO tbl_stats (lg_id, sta_ip, sta_agent, sta_host, sta_url, sta_time) VALUE ('$uid', '$ip', '$agent', '$host', '$url', '$time')";
$query = mysql_query($sql) or die (mysql_error());
}
else
{
$sql = "UPDATE tbl_stats SET lg_id = '$uid', sta_ip = '$ip', sta_agent = '$agent', sta_host = '$host', sta_url = '$url', sta_time = '$time' WHERE lg_id = $uid";
$query = mysql_query($sql) or die (mysql_error());
}
}
}
if($_GET['fare']=='modifica_utente')
{
}
if($_GET['fare']=='cancella_utente')
{
}