Skip to content

Commit

Permalink
-Création de la base de donnée
Browse files Browse the repository at this point in the history
-Ajout du nouveau usager de la page inscription.php
  • Loading branch information
Nicolas Mc Clure committed Apr 26, 2013
1 parent 47c3f18 commit 35be072
Show file tree
Hide file tree
Showing 12 changed files with 265 additions and 114 deletions.
145 changes: 96 additions & 49 deletions TP.clpprj

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ ul li {

/*-------contact.html-----*/

#bloc_contact {
#bloc_contact,#bloc_inscription {
background-color:#eee;
/*margin-top:-80px;*/
-moz-border-radius: 6px;
Expand All @@ -212,7 +212,7 @@ ul li {
padding-bottom: 10px;
}

#bloc_contact>h3 {
#bloc_contact>h3 ,#bloc_inscription>h3 {
padding-top: 40px;
}

Expand All @@ -226,7 +226,7 @@ ul li {
padding-right: 30px;
}

#bloc_contact ul {
#bloc_contact ul,#bloc_inscription ul {
margin-top: 60px;
}

Expand All @@ -235,7 +235,8 @@ ul li {
margin-left:155px;
}

#bloc_contact #form,

#bloc_contact #form,#bloc_inscription #form,
#map {
border: 2px solid black;
width:800px;
Expand All @@ -247,7 +248,7 @@ ul li {
}


#bloc_contact #form {
#bloc_contact #form ,#bloc_inscription #form{
margin-bottom:30px;
padding-bottom: 30px;
}
Expand Down Expand Up @@ -561,7 +562,8 @@ form.signin input::-webkit-input-placeholder { color:#bbb; text-shadow:0 0 2px #
/*-----favoris.php------*/

#bloc_favoris>h3 {
padding-top:30px;
padding-top:10px;
padding-bottom:15px;
}

.remove_favoris {
Expand All @@ -583,7 +585,7 @@ form.signin input::-webkit-input-placeholder { color:#bbb; text-shadow:0 0 2px #
}

#form #submit {
margin-left: 90px;
margin-left: 70px;
}

.img_titre {
Expand All @@ -592,3 +594,8 @@ form.signin input::-webkit-input-placeholder { color:#bbb; text-shadow:0 0 2px #
margin:20px;
margin-bottom: 20px;
}

#bloc_inscription #submit {
float:left;
margin-left:70px;
}
4 changes: 2 additions & 2 deletions contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<?php include("menu.php"); ?>
<div id="bloc_contact">
<h3>Contact </h3>
<form id="formulaire" action="confirmation.php" method="get">
<form id="formulaire" action="confirmation.php" method="POST">
<div id="form">
<ul>
<li class="lbl_contact"><label>Nom</label></li>
Expand Down Expand Up @@ -102,7 +102,7 @@
<li class="lbl_contact"><label>Commentaires</label></li>
<li><textarea rows="3" cols="40" name="champ_text" id="commentaires"></textarea></li>
<li class="lbl_contact"></li>
<li id="submit"><button id="btn_submit">Envoyer</button></li>
<li id="submit"><button class="btn btn-primary btn-medium btn btn-info" id="btn_submit">Envoyer</button></li>
</ul>
</div>
</form>
Expand Down
64 changes: 64 additions & 0 deletions data/bdd.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

$produits = array ('prod01'=>array(
'titre'=>'Canon EOS 60D',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/canon_eos_60d.jpg',
'prix'=>'1600',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
'prod02'=>array(
'titre'=>'GOPRO HERO 3',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/gopro_hero3_silver.jpg',
'prix'=>'800',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'

),
'prod03'=>array(
'titre'=>'Trepier en carbon',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/trepier.jpg',
'prix'=>'249',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
'prod04'=>array(
'titre'=>'Photoshop CS6',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/cs6.jpg',
'prix'=>'449',
'details'=>'Logiciel de retouche photos et + encore -compatible Windows,Mac et Linux'

),
'prod05'=>array(
'titre'=>'Objectif Nikon',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/nikon_objectif.png',
'prix'=>'999',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
'prod06'=>array(
'titre'=>'EOS Rebel T5i',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/canon_eos.jpg',
'prix'=>'929',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
'prod07'=>array(
'titre'=>'Nikon F6',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/nikonf6.png',
'prix'=>'2499',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
'prod08'=>array(
'titre'=>'Nikon S1',
'description'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus aliquet, nunc vitae aliquet egestas, nunc nisl varius augue, quis interdum risus nunc sed lorem. Cras at dolor orci. Phasellus et purus odio, vitae consequat magna. Suspendisse sit amet purus quis justo dignissim euismod. Suspendisse felis dolor, lobortis eget gravida id, sagittis at nisl. Cras et diam enim, sodales pretium sapien. Praesent nec velit sapien.',
'image'=>'assets/images/produits/nikons1.png',
'prix'=>'529,95',
'details'=>'Dimensions : 145,5 mm (L) × 112,5 mm (H) × 80,0 mm (P)'
),
);


?>
27 changes: 1 addition & 26 deletions data/user.inc
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
<?php
$users = array(
'jv6dmc' =>array(
'nom' => "Mc Clure",
'prenom' => "Nicolas",
'email' => 'nicolas.mcclure@hotmail.ca',
'password'=> '1234',
'favoris' => array(
'prod01',
'prod03',
'prod04'
)
),
'briou' =>array(
'nom' => "Riou",
'prenom' => "Brice",
'email' => 'briou69@gmail.ca',
'password'=> '4321',
'favoris' => array(
'prod01',
'prod03',
'prod04'
)
)
);
?>
a:1:{s:2:"br";a:5:{s:3:"nom";s:4:"riou";s:6:"prenom";s:5:"brice";s:5:"email";s:17:"briou69@gmail.com";s:8:"password";s:4:"1234";s:7:"favoris";a:0:{}}}
3 changes: 1 addition & 2 deletions favoris.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php require_once($_SERVER['DOCUMENT_ROOT'].'TP/'.'initialisation.inc');
require(REP_USERS.'user.inc');
include('script.php');


if (isset($_GET['remove'])) {
//echo($_GET['remove']);
Expand Down
2 changes: 1 addition & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div>
<footer>
<ul class="pager">
<li class="previous"><a href="index.html"><img src="assets/images/home.png" alt="glyphicon" class='glyph'/>Back to Home</a></li>
<li class="previous"><a href="index.php"><img src="assets/images/home.png" alt="glyphicon" class='glyph'/>Back to Home</a></li>
<li id="copyright" >Réalisé par N. McClure & B. Riou, Avril 2013 , ISI©</li>
<li class="next"><a href="#logo"><img src="assets/images/top.png" alt="glyphicon" class='glyph'/>Back to top</a></li>
</ul>
Expand Down
1 change: 0 additions & 1 deletion initialisation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ define('REP_USERS',ROOT.'data/' );
define('UTILISATEUR', 'user');



?>


54 changes: 47 additions & 7 deletions inscription.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
<?php
<?php require_once($_SERVER['DOCUMENT_ROOT'].'TP/'.'initialisation.inc');
require_once("managers/texteManager.php");


var_dump($_POST);

if ($_POST['name']!="" && $_POST['prenom']!="" && $_POST['email']!="" && $_POST['password']!="" && $_POST['username']!="" ){
//AJOUT
// 1.Lecture de tous les users
$chemin="data/user.inc";

$users=read_file($chemin);


$name_data= $_POST['name'];
$prenom_data= $_POST['prenom'];
$email_data= $_POST['email'];
$pass_data= $_POST['password'];

$user=array(

'nom' => "$name_data",
'prenom' => "$prenom_data",
'email' => "$email_data",
'password'=> "$pass_data",
'favoris' => array(

)

);


//ecriture dans le tableau
$users[$_POST['username']]=$user;
write_file($chemin,$users);

echo("ca marche inscription");
}else if(count($_POST)==0) {

}

?>

?>
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -32,7 +72,7 @@

</script>
<?php include("menu.php"); ?>
<div id="bloc_contact">
<div id="bloc_inscription">
<h3><img class="img_titre" src="assets/images/add_user.png">Inscription</h3>
<form id="formulaire_inscription" action="inscription.php" method="POST">
<div id="form">
Expand All @@ -42,8 +82,8 @@
<ul>
<li class="lbl_contact"><label>Nom</label></li>
<li><input type="text" name="name" id="name" placeholder="Nom..."/></li>
<li class="lbl_contact"><label>Pr&eacute;nom</label></li>
<li><input type="text" name="prenom" id="prenom" placeholder="Pr&eacute;nom..."/></li>
<li class="lbl_contact"><label>Prénom</label></li>
<li><input type="text" name="prenom" id="prenom" placeholder="Prénom..."/></li>
<li class="lbl_contact"><label>Courriel</label></li>
<li><input type="text" name="email" id="email" placeholder="abc@example.com"/></li>
<li class="lbl_contact"><label>Identifiant</label></li>
Expand All @@ -53,8 +93,8 @@
<li class="lbl_contact"><label>Confirmez Mot de passe</label></li>
<li><input type="password" name="conf_password" id="conf_password" placeholder="Retaper votre mot de passe"/></li>
<li class="lbl_contact"><label></label></li>
<li id="reset"><button type="reset" id="btn_reset">Effacer</button></li>
<li id="submit"><button id="btn_submit_inscription">Envoyer</button></li>
<li id="reset"><button class="btn btn-primary btn-medium btn btn-info" type="reset" id="btn_reset">Effacer</button></li>
<li id="submit"><button class="btn btn-primary btn-medium btn btn-info" id="btn_submit_inscription">Envoyer</button></li>
</ul>
</div>
</form>
Expand Down
32 changes: 24 additions & 8 deletions managers/texteManager.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
<?php

function open_file($chemin){
$fichier = fopen( $chemin, "r");
$contenu_du_fichier = fread($fichier, filesize($chemin));
$users= unserialize($contenu_du_fichier);
fclose($fichier);
return($users);
}



function save_file($chemin, $contenu_du_fichier) {
$fichier = fopen($chemin, "w");
fwrite($fichier, $contenu_du_tableau);
function read_file($chemin){
$fichier= fopen($chemin , "r");
$contenu_du_fichier=fread($fichier,filesize($chemin));
$users= unserialize($contenu_du_fichier);
fclose($fichier);

return $users;

}


function write_file($chemin,$users){
$contenu_du_tableau= serialize($users);
save_file($chemin, $contenu_du_tableau);
}


function open_file($chemin) {
$fichier = fopen($chemin, "r");
$contenu_du_fichier = fread($fichier, filesize($chemin));
function save_file($chemin, $contenu_du_fichier) {
$fichier = fopen($chemin, "w");
fwrite($fichier, $contenu_du_fichier);
fclose($fichier);
return($contenu_du_fichier);
}


?>
Loading

0 comments on commit 35be072

Please sign in to comment.