1 2 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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="format" href="styles/format.css" />
</head>
<div style="width:650px;margin-left:100px;">
<?
// connexion à la base avec l'utilisateur actuel
$connexion=mysql_connect('localhost','root','');
mysql_select_db('keinfor');
if ($connexion == false)
{
?><H3 ALIGN="center"><?exit("ERREUR DE CONNEXION A LA BASE");?></H3><?
}
$login = htmlentities ($_POST['login']);
$mdp = htmlentities ($_POST['mdp']);
$droit = htmlentities ($_POST['droit']);
//création de l'utilisateur
if(mysql_query("INSERT INTO mysql.user(host,user,password) VALUES('localhost','$login',PASSWORD('$mdp'))") == false)
{
?><H3 ALIGN="center"><?exit("ERREUR A LA CREATION DE L UTILISATEUR");?></H3><?
}
//attribution des droits
if($droit == "voir")
{
if(mysql_query("GRANT SELECT ON keinfor.* TO '$login'@'localhost' IDENTIFIED BY '$mdp'") == false
)
{
?><H3 ALIGN="center"><?exit("ERREUR LORS DE L ATTRIBUTION DES DROITS 1");?></H3><?
}
}
if($droit == "modif")
{
if(mysql_query("GRANT SELECT, INSERT, UPDATE, DELETE ON keinfor.*
TO '$login'@'localhost'
IDENTIFIED BY '$mdp'") == false
)
{
?><H3 ALIGN="center"><?exit("ERREUR LORS DE L ATTRIBUTION DES DROITS 1");?></H3><?
}
} ?>
<fieldset>
<legend><b>Création d'un utilisateur</b></legend> <!-- Titre du fieldset -->
<table class="nonTableau">
<tr>
<td class="field">Création de l'utilisateur <b><?echo $login;?><b></td>
</tr>
</table>
</fieldset>
</div>
</body>
</html> |
Partager