| 12
 3
 4
 5
 6
 7
 8
 9
 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
 93
 
 |  
 
<?
// première ébauche de l'application
 
$titre ="connection to users" ;
 
//parametre de connexion
 
 
$host = "localhost"; 
$user = "root"; 
$password = ""; 
$database = "user"; 
 
$conn = mysql_connect($host,$user,$password); 
if (!$conn) { 
    echo "Connection impossible\n"; 
    exit; 
} 
 
 
 
 
?>
<html>
<head><title><? echo $titre ; ?></title></head>
<body>
<h1><? echo $titre; ?></h1>
<form action="" method="POST">
date : <input type="text" name="jour" size="2">
/ <input type="text" name="mois" size="2">
/ <input type="text" name="annee" size="4">
 
<input type="submit" name="go" value="chercher">
</form>
<hr>
<table border="1">
<tr><th>ID</th><th>Login</th><th>Password</th><th>Nom</th><th>Prénom</th><th>Entite</th><th>Mail</th><th>Tel-pro-fix</th> <th>statut</th></tr>
<?
$sql = "SELECT Id, Login, Password, Nom, Prenom, Entite, Mail, Tel, Statut FROM utilisateur";
$a=mysql_select_db($database,$conn);
print_r("coucou",$a);
$result = mysql_query($sql, $conn);
 
 
//chaine de connexion pour la deuxieme base
 
 
 
$database1 = "glpi"; 
 
 
$a1=mysql_select_db($database1,$conn);
 
 
 
 
 
while($row = mysql_fetch_array($result)) { 
 
// requete:
 
 
$sql1 = "INSERT INTO `glpi_users` ( `ID` , `name` , `password` , `password_md5` , `email` , `phone` , `phone2` , `mobile` , `realname` , `firstname` , `location` , `tracking_order` , `language` , `list_limit` , `active` , `comments` , `id_auth` , `auth_method` , `last_login` , `date_mod` , `deleted` ) 
VALUES (
' ',".$row["Login"].",".$row["Password"].", NULL ,".$row["Mail"].", ".$row["Tel"].", NULL , NULL ,".$row["Prenom"].",".$row["Nom"].", '1' , '0', NULL , '20', '1', NULL , '-1', '-1', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0'
)";
 
 
 
echo "<tr>
<td>".$row["Id"]."</td>
<td>".$row["Login"]."</td>
<td>".$row["Password"]."</td>
<td>".$row["Nom"]."</td>
<td>".$row["Prenom"]."</td>
<td>".$row["Entite"]."</td>
<td>".$row["Mail"]."</td>
<td>".$row["Tel"]."</td>
<td>".$row["Statut"]."</td></tr>" ;
 
//Insertion
 
$result1 = mysql_query($sql1, $conn);
 
 
 
}
?>
</table>
</body>
</html> | 
Partager