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
| <?php
$link = mysqli_connect("localhost", "root", "", "comptebancaire");//or die("Error " . mysqli_error($con ));
$query = "SELECT * FROM client where id='".$idClient."' And pwd='".$password."'";
$query1 = "SELECT * FROM administrateur where id='".$id."' And pwd='".$password."'";
$result = mysqli_query($link, $query);
$result1 = mysqli_query($link, $query1);
$res = mysqli_fetch_array($result);
$res1 = mysqli_fetch_array($result1);
if ((!isset($_POST['pwd'])) && (!isset($_POST['id'])))
{
if (mysqli_num_rows($result)==0)
header('location:index.html');
else
{
session_start ();
$_SESSION['username'] = $_POST['id'];
$_SESSION['pwd'] = $_POST['pwd'];
if ($_POST['id'] == $res['idClient'])
header('location:client.php');
else
{
if ($res['statuts'] == 1)
header('location:admin.php');
else
header('location:conseiller.php');
}
}
}
else
header('location:index.html');
mysqli_free_result($result);
mysqli_close($link);
?> |
Partager