I need your help. For my website, I was using a simple PHP script that was creating an email with the description of my database and all the data in it, and it was sending it to my email once I clicked on a special link on the admin page.
Suddenly it does not work anymore, probably because the web server on which I uploaded the site has changed some parameters, which I cannot customize (I'm working on Altervista).
Do you have any idea of how to create a script that allows me to download the same backup by clicking on the same link, instead of receiving an email?
The former script was something like this
$table_top = "<table class=\"tab\">";
$table_bottom = "</table>";
$mail="<html><body>";
$add="whatever@example.com";
$tit="Backup MySQL (".date("d-m-Y, H:i",time()).")";
$headers="Content-type: text/htmlrn";
$query = "SHOW TABLES FROM my_database";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
$table = $row[0];
$mail.="<h2>table: ".$table."</h2>";
$query2 = "DESCRIBE $table";
$result2 = mysql_query($query2);
$mail.=$table_top;
$mail.="<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th><tr>";
while($row2 = mysql_fetch_row($result2)){
$k2=count($row2);
$mail.="<tr>";
for($i2=0; $i2<$k2; $i2++){
$mail.="<td>".$row2[$i2]."</td>";
}
$mail.="</tr>";
}
$mail.=$table_bottom."<br><br>";
$query2 = "SELECT * FROM $table";
$result2 = mysql_query($query2);
while($row2 = mysql_fetch_row($result2)){
$mail.="\"".$row2[0]."\"";
$i=1;
while(isset($row2[$i])){
$mail.=","."\"".$row2[$i]."\"";
$i=$i+1;
}
$mail.="<br>";
}
}
$mail.="</body></html>";
mail($add,$tit,$mail,$headers);
Thanks guys! :)