.01
.02
.03
.04
.05
.06
.07
.08
.09
.10
.11
.12
.13
.14
.15
.16
.17
.18
.19
.20
.21
.22
.23
.24
.25
.26
.27
.28
.29
.30
.31
.32
.33
.34
.35
.36
.37
.38
.39
.40
.41
.42
.43
.44
.45
.46
.47
.48
.49
.50
.51
.52
.53
.54
.55
.56
.57
.58
.59
.60
.61
.62
.63
.64
.65
.66
.67
.68
.69
.70
.71
.72
.73
.74
.75
.76
.77
.78
.79
.80
.81
.82
.83
.84
.85
.86
.87
.88
.89
.90
.91
.92
|
|
<?php
/******************************************************************************/
/* */
/* __ ____ */
/* ___ / / ___ / __/__ __ _____________ ___ */
/* / _ \/ _ \/ _ \_\ \/ _ \/ // / __/ __/ -_|_-< */
/* / .__/_//_/ .__/___/\___/\_,_/_/ \__/\__/___/ */
/* /_/ /_/ */
/* */
/* */
/******************************************************************************/
/* */
/* Titre : bilan rapide sur ses tables et leurs contenus */
/* */
/* URL : http://www.phpsources.org/scripts263-PHP.htm */
/* Auteur : roger */
/* Date édition : 23 Mars 2007 */
/* Website auteur : http://surmonarbre.free.fr */
/* */
/******************************************************************************/
echo '<form name="identifiants" method="post">
<table>
<tr><td width=200>Votre serveur </td><td>
<input type="text" name="serveur" size="20" value="localhost"/>
</td></tr>
<tr><td >Votre nom d\'utilisateur </td><td>
<input type="text" name="util" size="20" value="root"/>
</td></tr>
<tr><td >Votre mot de passe </td><td>
<input type="password" name="m_pass" size="20" value=""/>
</td></tr>
<tr><td >Et le nom de votre base </td><td>
<input type="text" name="bdd" size="20" />
</td></tr>
<tr><td colspan=2>
<input type="submit" name="action" value="Valider" />
</td></tr>
</form>';
if ( $action )
{
/* identifiant SERVEUR SQL base
$serveur="localhost";
$util="root";
$m_pass="";
$bdd="ma_base"; */
mysql_connect("$serveur","$util","$m_pass");
mysql_select_db("$bdd") or die ("la base n'as pas été trouvée");
$result_table = mysql_query("SHOW TABLES;");
$nbr_table = mysql_num_rows($result_table);
echo "<table width=450 border=1><tr>
<td colspan=2 bgColor=#0000FF align=center><b>
<font size=3 color=#FFFFFF>
$nbr_table tables sur $bdd</font></b></td></tr>";
while ($table = mysql_fetch_row($result_table))
{
echo "<tr><td width=150 bgColor=#00FFDE><b>";
print_r ($table[0])." "; // afficher les noms des tables
echo "</b>";
$champ = mysql_query("SHOW COLUMNS FROM $table[0]");
if (!$champ)
{
echo '<tr><td colspan=2>
Impossible d\'exécuter la requète :
' . mysql_error().'</td></tr>';
exit;
}
if ( mysql_num_rows($champ) > 0)
{
$nbr_champ = mysql_num_rows($champ);
echo "</td><td bgColor=#00FFDE>".$nbr_champ."
champs dans la table </td></tr>";
// affiche le nombre de champs dans la table
while ($contenu = mysql_fetch_assoc($champ))
{
echo "<tr><td width=150>";
print_r($contenu[Field]);
echo "</td><td >";
print_r($contenu[Type]);
echo "</td></tr>";
}
}
}
echo "</table>";
}
?>
|