Skip to content

Commit

Permalink
Init Config
Browse files Browse the repository at this point in the history
  • Loading branch information
Biajo committed Jan 19, 2015
0 parents commit b9a9a0c
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 0 deletions.
45 changes: 45 additions & 0 deletions ajouterUtilisateur.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
include'bddconnect.php';
if(isset($_POST["boutonInscription"]))
{
if((fVerificationIdNfc($_POST["nfc"]))&&(fVerificationLogin($_POST["login"]))&&(fVerificationMdp($_POST["mdp"])))
{
try
{
$_SESSION["idNfc"]=$_POST["nfc"];

$ajouterUtilisateur=$dbconnexion->prepare("INSERT INTO identifiants (idTag, login, motdepasse) VALUES (:idNfcUtil,:loginUtil,:mdpUtil);");
$ajouterUtilisateur->bindValue(':idNfcUtil',$_POST["nfc"],PDO::PARAM_STR);
$ajouterUtilisateur->bindValue(':loginUtil',$_POST["login"],PDO::PARAM_STR);
$ajouterUtilisateur->bindValue(':mdpUtil',$_POST["mdp"],PDO::PARAM_STR);
$ajouterUtilisateur->execute();
}
catch(PDOException $e)
{

}
}
else
{

header('location:index.php?mess=erreur_inscription');
}
}
?>
<?php
function fVerificationIdNfc($nfc)
{
$nfcValide="/^[0-9]{5,30}$/";
return preg_match($nfcValide,$nfc);
}
function fVerificationLogin($login)
{
$loginValide="/^[a-zA-Z0-9_-]{4,30}$/";
return preg_match($loginValide,$login);
}
function fVerificationMdp($mdp)
{
$mdpValide="/^[a-zA-Z0-9?@\.;:!_-]{5,30}$/";
return preg_match($mdpValide,$mdp);
}
?>
13 changes: 13 additions & 0 deletions bddconnect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

try
{
$dbconnexion=new PDO("mysql:host=localhost;dbname=tpmSmartCity","root","");
}

catch(PDOexception $e)
{
header('location:index.php?mess=echec+de+la+connexion');
exit;
}
?>
Empty file added connexion.php
Empty file.
30 changes: 30 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WebApp</title>
</head>
<body>
<div class="contener">
<div class="header">
<a href="">Classement Stade</a>
<a href="">Classement Personnel</a>
<a href=""></a>
<div class="connexion">
<a href="inscription.php">Inscription</a>
</div>
</div>
<div class="mainContener">

</div>
</div>
</body>
</html>
27 changes: 27 additions & 0 deletions inscription.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WebApp</title>
</head>
<body>
<div class="contener">
<div class="header">
<a href="">Classement Stade</a>
<a href="">Classement Personnel</a>
<a href=""></a>
<div class="connexion">
</div>
</div>
<div class="mainContener">
<form action="ajouterUtilisateur.php" method="POST">
<label for="">ID NFC</label><input type="text" id="idNFC" name="nfc">
<label for="">Login</label><input type="text" id="login" name="login">
<label for="">Mot de passe</label><input type="text" id="mdp" name="mdp">
<button type="submit" name="boutonInscription">Envoyer</button>
</form>
</div>
</div>
</body>
</html>

0 comments on commit b9a9a0c

Please sign in to comment.