<?php
// à mettre tout en haut du fichier .php, cette fonction propre à PHP servira à maintenir la $_SESSION
session_start();
include("config.php");
$error = false;
$adminpageError = "";
$code4Error = "";
$code4noncorrespondError = "";
if (isset($_SESSION['username']) && $_SESSION['username'] =="admin") {
$adminpageError = "<p><a href='inscription.php'>Admin page </a></p>";
}
if(isset($_POST['valider'])){
if (empty($_POST['code'])) {
$error = true;
$codetransfert4Error = "Please enter the transfer code .";
} else {
$code4 = htmlentities($_POST['code4'], ENT_QUOTES, "ISO-8859-1");
$mysqli = mysqli_connect("localhost", "id4295068_roomadmin", "", "id4295068_projet");
if (!$mysqli) {
echo "Please check your information and try again";
} else {
$query = "SELECT * FROM `client6` WHERE code4='".$code4."'";
$result = mysqli_query($mysqli,$query) or die(mysqli_error());
$rows = mysqli_num_rows($result);
if($rows==1) {
header("location: load4.php");
} else {
$query = "SELECT * FROM `client6` WHERE code4='".$code4."'";
$result = mysqli_query($mysqli,$query) or die(mysqli_error());
$rows = mysqli_num_rows($result);
if($rows==0) {
header("location: transfert4non.php");
}
}
}
}
}
// Si tout va bien, on peut continuer
// On récupère tout le contenu de la table client6
$req = $mysqli->prepare('SELECT * FROM `client6` WHERE username = :username');
$req->execute(array('username' => $_SESSION['username']));
// On affiche chaque entrée une à une
while ($donnees = $req->fetch())
?>