Corrigé sujet Bac 2012 (11H)
Corrigé sujet Bac 2012 (11H)
télécharger le sujet à l'adresse :
http://www.kiteb.net/education/informatique/bac/bacinfo2012/bac-pratique-21052012-tic-11h.pdf
pour pouvoir exécuter les scripts convenablement veuillez créer la base de données comme indiqué au sujet mais avec le nom "sujet11h2012"
puis copier les scripts htm dans frontpage et les script php sur notepad puis enregistrer dans c:\Program Files\easyPHP\www
************************Page ajout.htm****************************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ajout reclamation</title>
<script language="javascript">
function verif(f)
{
if (isNaN(f.tel.value) || f.tel.value.length != 8 ) { alert('tel incorrect'); return false;}
if(f.cat.selectedIndex=='') { alert('catégorie obligatoire'); return false;}
if(f.cat.value=='4' && f.descrip.value=='') { alert('remplir la description'); return false;}
}
</script>
<style type="text/css">
<!--
.Style1 {
font-size: 18px;
font-weight: bold;
color: #CC0066;
}
-->
</style>
</head>
<body>
<div align="center" class="Style1">AJOUT D'UNE RECLAMATION</div>
<form id="form1" name="f" method="post" action="ajout.php" onsubmit="return verif(f)">
<p><strong>Tél Client :</strong>
<label>
<input type="text" name="tel" id="textfield" size="20" maxlength="8" />
</label>
</p>
<p><strong>Catégorie :</strong></p>
<p>
<label>
<select name="cat" size="1" id="select">
<option value="0">choisir une catégorie</option>
<option value="1">Authentification</option>
<option value="2">Branchement</option>
<option value="3">Synchronisation</option>
<option value="4">Autres</option>
</select>
</label>
</p>
<p><strong>Déscription :</strong></p>
<p>
<label>
<textarea name="descrip" id="textarea" cols="45" rows="3"></textarea>
</label>
</p>
<p>
<input type="submit" name="button" id="button" value="Valider" />
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
</form>
<p> </p>
</body>
</html>
**********************script ajout.php****************************
<?php
$con=mysql_connect('localhost','root','') or die('connexion impossible');
$a=mysql_select_db('sujet11h2012',$con) or die ('base introuvable');
$t=$_POST['tel'];
$g=$_POST['cat'];
$d=$_POST['descrip'];
$res=mysql_query("SELECT * FROM client WHERE '$t'=telclt");
$n=mysql_num_rows($res);
if($n==0) { echo ('client non enregistré dans la base de données');}
else { $res1=mysql_query("SELECT * FROM reclamation WHERE '$t'=telclt");
$ligne=mysql_fetch_array($res1);
if ($ligne['etat']=='N') echo('le client a une réclamation non traitée');
//$dat='';
else mysql_query("INSERT INTO reclamation VALUES ('','$d','N','$dat','','$t','$g')");
}
?>
*********************traitement.htm*******************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>traitement</title>
<script language="javascript">
function verif(f)
{
if (isNaN(f.tel.value) || f.tel.value.length!= 8 ) { alert('tel incorrect'); return false;}
a=f.dater.value.substr(0,4);
m=f.dater.value.substr(5,2);
j=f.dater.value.substr(8,2);
if(isNaN(a) || m<1 || m>12 || j<1 || j>31) { alert('date incorrrecte'); return false;}
}
</script>
<style type="text/css">
<!--
.Style1 {
color: #9900FF;
font-weight: bold;
font-size: 24px;
}
.Style2 {
font-size: 16px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center" class="Style1">TRAITEMENT D'UNE RECLAMATION</div>
<form action="traitement.php" method="post" name="f" onsubmit="return verif(f)">
<p>Tél Client :
<label>
<input type="text" name="tel" id="tel" size="20" maxlength="8" />
</label>
</p>
<p>Date Réparation :
<input name="dater" type="text" id="dater" maxlength="10" size="23" />
</p>
<p>
<label>
<input type="submit" value="Valider" />
</label>
<label>
<input type="reset" name="button2" id="button2" value="Annuler" />
</label>
</p>
</form>
<p> </p>
</body>
</html>
********************traitement.php*********************
<?php
$con=mysql_connect('localhost','root','') or die('connexion impossible');
$a=mysql_select_db('sujet11h2012',$con) or die ('base introuvable');
$t=$_POST['tel'];
$d=$_POST['dater'];
$res=mysql_query("SELECT * FROM client WHERE '$t'=telclt");
$n=mysql_num_rows($res);
if($n==0) { echo ('client non enregistré dans la base de données');}
else { $res1=mysql_query("SELECT * FROM reclamation WHERE '$t'=telclt");
$ligne=mysql_fetch_array($res1);
if ($ligne['etat']=='O') echo('le client n\'a pas de réclamation non traitée');
else mysql_query("UPDATE reclamation SET etat='O' , daterep='$d' WHERE '$t'=telclt");
echo'Réclamation réglée';
}
?>
http://www.kiteb.net/education/informatique/bac/bacinfo2012/bac-pratique-21052012-tic-11h.pdf
pour pouvoir exécuter les scripts convenablement veuillez créer la base de données comme indiqué au sujet mais avec le nom "sujet11h2012"
puis copier les scripts htm dans frontpage et les script php sur notepad puis enregistrer dans c:\Program Files\easyPHP\www
************************Page ajout.htm****************************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ajout reclamation</title>
<script language="javascript">
function verif(f)
{
if (isNaN(f.tel.value) || f.tel.value.length != 8 ) { alert('tel incorrect'); return false;}
if(f.cat.selectedIndex=='') { alert('catégorie obligatoire'); return false;}
if(f.cat.value=='4' && f.descrip.value=='') { alert('remplir la description'); return false;}
}
</script>
<style type="text/css">
<!--
.Style1 {
font-size: 18px;
font-weight: bold;
color: #CC0066;
}
-->
</style>
</head>
<body>
<div align="center" class="Style1">AJOUT D'UNE RECLAMATION</div>
<form id="form1" name="f" method="post" action="ajout.php" onsubmit="return verif(f)">
<p><strong>Tél Client :</strong>
<label>
<input type="text" name="tel" id="textfield" size="20" maxlength="8" />
</label>
</p>
<p><strong>Catégorie :</strong></p>
<p>
<label>
<select name="cat" size="1" id="select">
<option value="0">choisir une catégorie</option>
<option value="1">Authentification</option>
<option value="2">Branchement</option>
<option value="3">Synchronisation</option>
<option value="4">Autres</option>
</select>
</label>
</p>
<p><strong>Déscription :</strong></p>
<p>
<label>
<textarea name="descrip" id="textarea" cols="45" rows="3"></textarea>
</label>
</p>
<p>
<input type="submit" name="button" id="button" value="Valider" />
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
</form>
<p> </p>
</body>
</html>
**********************script ajout.php****************************
<?php
$con=mysql_connect('localhost','root','') or die('connexion impossible');
$a=mysql_select_db('sujet11h2012',$con) or die ('base introuvable');
$t=$_POST['tel'];
$g=$_POST['cat'];
$d=$_POST['descrip'];
$res=mysql_query("SELECT * FROM client WHERE '$t'=telclt");
$n=mysql_num_rows($res);
if($n==0) { echo ('client non enregistré dans la base de données');}
else { $res1=mysql_query("SELECT * FROM reclamation WHERE '$t'=telclt");
$ligne=mysql_fetch_array($res1);
if ($ligne['etat']=='N') echo('le client a une réclamation non traitée');
//$dat='';
else mysql_query("INSERT INTO reclamation VALUES ('','$d','N','$dat','','$t','$g')");
}
?>
*********************traitement.htm*******************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>traitement</title>
<script language="javascript">
function verif(f)
{
if (isNaN(f.tel.value) || f.tel.value.length!= 8 ) { alert('tel incorrect'); return false;}
a=f.dater.value.substr(0,4);
m=f.dater.value.substr(5,2);
j=f.dater.value.substr(8,2);
if(isNaN(a) || m<1 || m>12 || j<1 || j>31) { alert('date incorrrecte'); return false;}
}
</script>
<style type="text/css">
<!--
.Style1 {
color: #9900FF;
font-weight: bold;
font-size: 24px;
}
.Style2 {
font-size: 16px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center" class="Style1">TRAITEMENT D'UNE RECLAMATION</div>
<form action="traitement.php" method="post" name="f" onsubmit="return verif(f)">
<p>Tél Client :
<label>
<input type="text" name="tel" id="tel" size="20" maxlength="8" />
</label>
</p>
<p>Date Réparation :
<input name="dater" type="text" id="dater" maxlength="10" size="23" />
</p>
<p>
<label>
<input type="submit" value="Valider" />
</label>
<label>
<input type="reset" name="button2" id="button2" value="Annuler" />
</label>
</p>
</form>
<p> </p>
</body>
</html>
********************traitement.php*********************
<?php
$con=mysql_connect('localhost','root','') or die('connexion impossible');
$a=mysql_select_db('sujet11h2012',$con) or die ('base introuvable');
$t=$_POST['tel'];
$d=$_POST['dater'];
$res=mysql_query("SELECT * FROM client WHERE '$t'=telclt");
$n=mysql_num_rows($res);
if($n==0) { echo ('client non enregistré dans la base de données');}
else { $res1=mysql_query("SELECT * FROM reclamation WHERE '$t'=telclt");
$ligne=mysql_fetch_array($res1);
if ($ligne['etat']=='O') echo('le client n\'a pas de réclamation non traitée');
else mysql_query("UPDATE reclamation SET etat='O' , daterep='$d' WHERE '$t'=telclt");
echo'Réclamation réglée';
}
?>
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|