<?php
/*#####################AYARLAR################################*/
$dbname = 'wp';//veritabanı adı
mysql_connect('localhost', 'root', 'mysql');//bağlantı bilgiler
/*############################################################*/
header('Content-Type: text/html; charset=utf-8');
date_default_timezone_set('Europe/Istanbul');
mysql_select_db($dbname);
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
$filename = 'DB.TXT';
if(@$_GET['delete']){
if(is_file($filename)) {
unlink($filename);
}elseif(@$_GET['update']){
header("Location: index.php");
}else{header("Location: index.php");}
}
if (!file_exists($filename)) {
$file = fopen($filename, 'w');
while ($row = mysql_fetch_row($result)) {
$r = mysql_fetch_array(mysql_query("SELECT count(*) as c FROM ".$row[0]));
$total = $r["c"];
fwrite($file, $row[0]."(".$total.")" . "n");
}
fclose($file);
header("Location: index.php");
}else{
$fp = @fopen($filename, 'r');
if ($fp) {
$array = explode("n", fread($fp, filesize($filename)));
}
$i=-1;
echo '<table border=1>
<tr><th colspan=2>'.$filename.' - '.date("d.m.Y H:i:s",filemtime($filename)).'</th></tr>
<tr><th colspan=2>
<button onclick="javascript:location.href='index.php?update=ok'">Veritabanı Güncelle</button>
<button onclick="javascript:location.href='index.php?delete=ok'">DB.TXT Güncelle</button>
<tr><th>CANLI VERİTABANI</th><th>KAYITLI DOSYA YEDEĞİ</th></tr>';
while ($row = mysql_fetch_row($result)) {
$i++;
$r = mysql_fetch_array(mysql_query("SELECT count(*) as c FROM ".$row[0]));
$total = $r["c"];
echo "<tr>";
echo "<td>";
echo $row[0]."(".$total.")";
echo "</td><td>";
echo $array[$i];
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
?>
Son Yapılan İşlemin Hangi Veritabanına Eklendiğini Kontrol Etme
Kendi ihtiyacımdan dolayı yazdım.Hazır scriptlerdeki karmaşık form kayıtlarının hangi veritabanına eklediğini bulmak için geliştirdim.Umarım işinize yarar.