Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Index.

html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>index</title>
<link rel="stylesheet" href="mesStyles.css">
</head>
<body>

<nav>
<ul>
<li><a href="Equipe.html" target="zone2">Ajouter une équipe
</a></li>
<li><a href="participation.html" target="zone2">Inscrire un Match
</a></li>
<li><a href="aff.php" target="zone2">Affichage des matchs en
cours</a></li>

</ul>
</nav>
<section>
<iframe src="Equipe.html" frameborder="0" name="zone2"></iframe>
</section>
<footer>
<h1>BasketBall</h1>
</footer>
</body>
</html>
Equipe.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enregistrement</title>
<script src="controle.js"></script>
</head>
<body>
<form action="" onsubmit="return verif1()">
<fieldset>
<legend>Nouvelle Equipe:</legend>
<table>
<tr>
<th>Code équipe:</th>
<td><input type="text" id="id1" name="T1"></td>
</tr>
<tr>
<th>Libellé:</th>
<td><input type="text" id="id2" name="T2"></td>
</tr>

<tr>
<th>Date Fondation:</th>
<td><input type="text" id="id3" name="T3"></td>
</tr>
<tr>
<th>Titres fonciers:</th>
<td><input type="checkbox" id="id4" name="C1" value="TR">Terrain
<input type="checkbox" id="id5" name="C2" value="VE">Vestiaire
</td>
</tr>
<tr>
<th>Mot de passe:</th>
<td><input type="text" id="id6" name="T4"></td>
</tr>
<tr>
<td></td>
<td><input type="reset" value="Annuler" id="id7" name="B1">
<input type="submit" value="Ajouter" id="id8" name="B2"></td>
</tr>
</table>
</fieldset>

</form>
</body>
</html>
Participation.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enregistrement</title>
<script src="controle.js"></script>
</head>
<body>
<form action="" onsubmit="return verif1()">
<fieldset>
<legend>Nouvelle Equipe:</legend>
<table>
<tr>
<th>Code équipe:</th>
<td><input type="text" id="id1" name="T1"></td>
</tr>
<tr>
<th>Libellé:</th>
<td><input type="text" id="id2" name="T2"></td>
</tr>

<tr>
<th>Date Fondation:</th>
<td><input type="text" id="id3" name="T3"></td>
</tr>
<tr>
<th>Titres fonciers:</th>
<td><input type="checkbox" id="id4" name="C1" value="TR">Terrain
<input type="checkbox" id="id5" name="C2" value="VE">Vestiaire
</td>
</tr>
<tr>
<th>Mot de passe:</th>
<td><input type="text" id="id6" name="T4"></td>
</tr>
<tr>
<td></td>
<td><input type="reset" value="Annuler" id="id7" name="B1">
<input type="submit" value="Ajouter" id="id8" name="B2"></td>
</tr>
</table>
</fieldset>

</form>
</body>
</html>
mesStyles.css

footer{
background-color: #9f1b9b;
}

nav {
background-color: #e760d7;
width: 30%;
height: 480px;
float: left;
}
section {
background-color: #2b65a9;
width: 70%;
height: 480px;
float: left;
}
iframe {
width: 99%;
height: 470px;

}
h1{
transition: text 2s;
text-align:center;
color:white;
}
h1:hover{
text-decoration: underline;
}
#id6{
background-color: #f0f8ff;
font-size: 17px;

Contrôle.js

function chiffre(ch){
i=0;
while ((ch.charAt(i)>="0")&&(ch.charAt(i)<="9")&& (i<ch.length)){
i++;//i=i+1
}
return (i==ch.length);

}
function alphat(ch){
ch=ch.toUpperCase();
i=0;
while ((ch.charAt(i)>="A")&&(ch.charAt(i)<="Z")&& (i<ch.length)){
i++;//i=i+1
}
return (i==ch.length);

}
function somchif(ch){
s=0;
for (i=0;i<ch.length;i++){
s=s+Number(ch.charAt(i));
}
return s;
}
function verifDate(c){
OK=true;
aaaa=Number(c.substr(0,4));
mm=Number(c.substr(5,2));
jj=Number(c.substr(8,2));
if ((c=="")||(c.length != 10)){
OK=false;
}
if ((aaaa<1000)||(aaaa>9999)){
OK=false;
}
if ((mm<1)||(mm>12)){
OK=false;
}
if ((c.charAt(4) != "-")||(c.charAt(7) !="-")){
OK=false;
}
switch(mm){
case 1:case 3:case 5:case 7:case 8:case 10:case 12:
if ((jj<1)||(jj>31)){
OK=false;
};
break;
case 4:case 6:case 9:case 11:
if ((jj<1)||(jj>30)){
OK=false;
};
break;
case 2:
if (aaaa % 4 == 0){
if ((jj<1) ||(jj>29)){
OK=false;
};
}
else{
if ((jj<1)||(jj>28)){
OK=false;
};
}
break;

return OK;
}
function verif1(){
var a=document.getElementById("id1").value;
ch1=a.substr(1,4);
var b=document.getElementById("id2").value;
var c=document.getElementById("id3").value;

resultat=true;
if ((a=="")||(a.charAt(0) != "E")||(chiffre(ch1)==false) ||(a.length !=
5)){
alert("Le code équipe invalide!!!!");
resultat=false;
}
else{
if ((b=="")||(alphat(b)==false)){
alert("Le libellé équipe invalide!!!!");
resultat=false;
}
else{
if ((c=="")||(verifDate(c)==false)){
alert("La date de fondation invalide!!!!");
resultat=false;
}
else{
if
((document.getElementById("id4").checked==false)&&(document.getElementById("id
5").checked==false)){
alert("Choisir le titre foncierw!!!!");
resultat=false;
}
else{
document.getElementById("id6").value=(somchif(ch1)+b.lengt
h)*Number(c.substr(0,4));

}
}
}
}
return resultat;
}
function sysDate(){
d=new Date();
a=d.getFullYear();
m=d.getMonth()+1;
if (m<10){
m="0"+m;
}
j=d.getDate();
if (j<10){
j="0"+j;
}
document.getElementById("id4").value=a+"-"+m+"-"+j;
}
function verif2(){
resultat=true;
var a=document.getElementById("id1").value;
ch1=substr(1,7);
var b=document.getElementById("id2").value;
var c=document.getElementById("id3").value;
if ((a=="")||(a.charAt(0) != "M")||(chiffre(ch1) == false)||(a.length !=
8)){
alert("Code match invalide");
resultat=false;
}
else{
if (b==c){
alert("Code equipe1 doit être différent de code équipe 2");
resultat=false;
}
else{
ch2=b.substr(1,4);
if ((b=="")||(b.charAt(0) != "E")||(chiffre(ch2) ==
false)||(b.length != 5)){
alert("Code equipe1 invalide");
resultat=false;
}
else{
ch3=c.substr(1,4);
if ((c=="")||(c.charAt(0) != "E")||(chiffre(ch3) ==
false)||(c.length != 5)){
alert("Code equipe2 invalide");
resultat=false;
}
else{
if
((document.getElementById("id5").checked==false)&&(document.getElementById("id
6").checked==false)){
alert("Choisir durée du match");
resultat=false;
}
}
}
}
}
return resultat;
}
Jouer.php

<?php
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("bd333sadrag1") or die (mysql_error());
$a=$_POST['T1'];
$b=$_POST['T2'];
$c=$_POST['T3'];
$d=$_POST['T4'];
$e=$_POST['R1'];
$req1="select *
from matchs
where code_match = '$a'";
$r1=mysql_query($req1) or die (mysql_error());
if (mysql_num_rows($r1) ==0){
echo "Code match n'existe pas";
}
else{
$req2="select *
from equipe
where code_equi='$b'";
$r2=mysql_query($req2) or die (mysql_error());
if (mysql_num_rows($r2) ==0){
echo "L'équipe 1 n'existe pas";
}
else{
$req3="select *
from equipe
where code_equi='$c'";
$r3=mysql_query($req3) or die (mysql_error());
if (mysql_num_rows($r3) ==0){
echo "L'équipe 2 n'existe pas";
}
else{
$ds=strtotime("now");
$hd=date("H:i:s",$ds);
$hf=date("H:i:s",strtotime("+$e minute"));
$req4="insert into participation
values ('$a','$b','$c','$d','$hd','$hf')";
$r4=mysql_query($req4) or die (mysql_error());
echo "L'inscrit du match est fait avec succès";
}
}
}
mysql_close();
?>

You might also like