parent
1615e5f166
commit
016595d067
@ -0,0 +1,133 @@
|
||||
<link rel="stylesheet" href="css.css">
|
||||
<meta charset="UTF-8">
|
||||
<h1>Morpion</h1>
|
||||
<p>
|
||||
<form method="post">
|
||||
<input type="text" name="forme" required="required" placeholder="Mettre X ou O" maxlength="1">
|
||||
<input type="number" name="case" required="required" placeholder="Emplacement (1-9)" maxlength="1">
|
||||
<button type="submit">Inserer</button>
|
||||
</form>
|
||||
</p>
|
||||
<?php
|
||||
class MyDB extends SQLite3
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
$this->open('mysqlitedb.db');
|
||||
}
|
||||
}
|
||||
|
||||
$db = new MyDB();
|
||||
|
||||
|
||||
$colonne="";
|
||||
|
||||
if(isset($_POST['case'])){
|
||||
|
||||
if($_POST['case']=='1'){
|
||||
$colonne='un';
|
||||
}
|
||||
elseif ($_POST['case']=='2'){
|
||||
$colonne='deux';
|
||||
}
|
||||
elseif ($_POST['case']=='3'){
|
||||
$colonne='trois';
|
||||
}
|
||||
elseif ($_POST['case']=='4'){
|
||||
$colonne='quatre';
|
||||
}
|
||||
elseif ($_POST['case']=='5'){
|
||||
$colonne='cinq';
|
||||
}
|
||||
elseif ($_POST['case']=='6'){
|
||||
$colonne='six';
|
||||
}
|
||||
elseif ($_POST['case']=='7'){
|
||||
$colonne='sept';
|
||||
}
|
||||
elseif ($_POST['case']=='8'){
|
||||
$colonne='huit';
|
||||
}
|
||||
elseif ($_POST['case']=='9'){
|
||||
$colonne='neuf';
|
||||
}
|
||||
else{
|
||||
$colonne='null';
|
||||
}
|
||||
}
|
||||
$valeur="";
|
||||
if(isset($_POST['forme'])){
|
||||
$valeur=$_POST['forme'];
|
||||
}
|
||||
|
||||
|
||||
header("refresh: 2");
|
||||
//$db->exec('CREATE TABLE partie(Id STRING,un STRING,deux STRING,trois STRING, quatre STRING,cinq STRING,six STRING,sept STRING,huit STRING,neuf STRING)');
|
||||
|
||||
|
||||
|
||||
|
||||
$idpartie = "BQANQsS";
|
||||
|
||||
|
||||
|
||||
if(isset($colonne)and $valeur!="" and $colonne!=''){
|
||||
|
||||
$aff=$db->query('SELECT "'.$colonne.'" FROM partie where Id="'.$idpartie.'" ');
|
||||
$res = $aff->fetchArray();
|
||||
|
||||
if(strlen($res[$colonne])==1){
|
||||
echo " <p> Insertion impossible une valeur est déjà à l'intérieur</p> <br>";
|
||||
}
|
||||
else{
|
||||
$update = $db->query('UPDATE partie SET "'.$colonne.'" = "'.$valeur.'" where Id="'.$idpartie.'" ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//$db->query('INSERT INTO partie(Id) VALUES("'.$idpartie.'")');
|
||||
|
||||
//$db->query('INSERT INTO partie(Id) VALUES("'.$idpartie.'")');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$afficher = $db->query('SELECT * FROM partie where Id="'.$idpartie.'" ');
|
||||
while ($row = $afficher->fetchArray()) {
|
||||
|
||||
$un=$row['un'];
|
||||
$deux=$row['deux'];
|
||||
$trois=$row['trois'];
|
||||
$quatre=$row['quatre'];
|
||||
$cinq=$row['cinq'];
|
||||
$six=$row['six'];
|
||||
$sept=$row['sept'];
|
||||
$huit=$row['huit'];
|
||||
$neuf=$row['neuf'];
|
||||
|
||||
|
||||
}
|
||||
echo "
|
||||
<table>
|
||||
<tr>
|
||||
<td>$un</td>
|
||||
<td>$deux</td>
|
||||
<td>$trois</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>$quatre</td>
|
||||
<td>$cinq</td>
|
||||
<td>$six</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>$sept</td>
|
||||
<td>$huit</td>
|
||||
<td>$neuf</td>
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
|
||||
?>
|
@ -0,0 +1,40 @@
|
||||
body{
|
||||
margin: 0; /* pour éviter les marges */
|
||||
text-align: center; /* pour corriger le bug de centrage IE */
|
||||
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 4em;
|
||||
font-weight: 700;
|
||||
font-family: 'Titillium Web';
|
||||
text-align: center;
|
||||
}
|
||||
table {
|
||||
margin: auto;
|
||||
}
|
||||
td {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
text-align: center;
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
td:nth-last-of-type(2) {
|
||||
border-left: 2px solid black;
|
||||
border-right: 2px solid black;
|
||||
}
|
||||
|
||||
tr:nth-last-of-type(2) td{
|
||||
border-top: 2px solid black;
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
|
||||
p{
|
||||
text-align: center;
|
||||
color: #F43C3F
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in new issue