parent
90a2ff0769
commit
ee90e9a021
@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../:\wamp64\www\Test\TP2\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||
<serverData>
|
||||
<paths name="tesss">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.iml" filepath="$PROJECT_DIR$/.idea/.idea.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1 +0,0 @@
|
||||
bddt.php
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -1,5 +0,0 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
@ -1,134 +0,0 @@
|
||||
<link rel="stylesheet" href="css.css">
|
||||
<link rel="icon" href="test.ico" />
|
||||
<meta charset="UTF-8">
|
||||
|
||||
|
||||
<form>
|
||||
<button type="submit"><a href="DB.php?action=Creer">Creer Partie</a></button>
|
||||
</form>
|
||||
<form>
|
||||
<input type="" name="placer" id="MettreID" placeholder="Mettre ID partie">
|
||||
<button name="action" type="submit"><a href="DB.php?action=Rejoindre">Creer Partie</a></button>
|
||||
</form>
|
||||
<h1>Morpion</h1>
|
||||
|
||||
<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" name="action">Inserer</button>
|
||||
</form>
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
<?php
|
||||
require("MyDB.php");
|
||||
$db = new MyDB();
|
||||
|
||||
|
||||
$action = $_REQUEST['action'] ?? NULL;
|
||||
echo $action;
|
||||
|
||||
if($action=="Creer"){
|
||||
$partiecreer=genererChaineAleatoire();
|
||||
$db->query('INSERT INTO partie(Id) VALUES("'.$partiecreer.'")');
|
||||
$idpartie=$partiecreer;
|
||||
require("DB.php");
|
||||
}
|
||||
if($action=="Rejoindre"){
|
||||
$idpartie=$_POST['placer'];
|
||||
$idpartie=$partiecreer;
|
||||
require("DB.php");
|
||||
}
|
||||
|
||||
echo "<h2>Id : $idpartie</h2>" ;
|
||||
$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)');
|
||||
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.'" ');
|
||||
}
|
||||
}
|
||||
|
||||
$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>
|
||||
";
|
||||
|
||||
?>
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
require("MyDB.php");
|
||||
|
||||
$db = new MyDB();
|
||||
|
||||
$chaine = genererChaineAleatoire(10);
|
||||
|
||||
|
||||
if(isset($_POST['id'])){
|
||||
$id=$_POST['id'];
|
||||
}
|
||||
$id=genererChaineAleatoire(10);
|
||||
|
||||
|
||||
function section()
|
||||
{
|
||||
echo 'coucou';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css.css">
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<p>
|
||||
<form method="post">
|
||||
<button type="submit" name="idd" value='<?php echo $id; ?>'><a href='DB.php?idd=<?php echo $id; $db->query('INSERT INTO partie(Id) VALUES("'.$id.'")');?>'>Créer une partie</a></button>
|
||||
<form>
|
||||
|
||||
<form method="post">
|
||||
<input type="text" required="required" placeholder="Mettre ID partie" maxlength="11">
|
||||
<button type="submit" name="idd" value=""><a href="DB.php?idd=">Rejoindre</a></button>
|
||||
</form>
|
||||
<form method="post">
|
||||
<button><a href="<?php echo "ss";?> ">FSS</a>FSS</button>
|
||||
</form>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?php
|
||||
header('Location: MyxDB.php');
|
||||
exit();
|
||||
?>
|
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal">
|
||||
<data-source name="mysqlitedb" uuid="cbb882be-2348-4146-af52-dfba24062938">
|
||||
<database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="SQLITE" exact-version="0" />
|
||||
<auth-provider>no-auth</auth-provider>
|
||||
<schema-mapping />
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="mysqlitedb" uuid="cbb882be-2348-4146-af52-dfba24062938">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:D:\wamp64\www\Test\MorpionPhp\mysqlitedb.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
$idparte =$_SESSION['idpartie'];
|
||||
echo "<h2 id='ids'>Identifiant partie : <strong>$idparte</strong> <button onclick='myFunction()' type='button' class='btn btn-dark'>Copier Id</button></h2>" ;
|
||||
echo "<input type='text' class='myInput' value='$idparte' id='myInput'>";
|
||||
?>
|
||||
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
class MyDB extends SQLite3
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
$this->open('mysqlitedb.db');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
session_start();
|
||||
$idpartie = $_SESSION['idpartie'];
|
||||
$db = new MyDB();
|
||||
|
||||
$rows = $db->query('SELECT COUNT(*) as count FROM partie where Id="'.$idpartie.'" ');
|
||||
$row = $rows->fetchArray();
|
||||
$numRows = $row['count'];
|
||||
|
||||
$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'];
|
||||
|
||||
|
||||
}
|
||||
if($numRows!=1){
|
||||
echo "<h1>Identifiant inconnu<h1>";
|
||||
}
|
||||
else{
|
||||
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>
|
||||
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
|
||||
class MyDB extends SQLite3
|
||||
{
|
||||
function __construct()
|
@ -0,0 +1,147 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Morpion</title>
|
||||
<script src="js.js"></script>
|
||||
<link rel="icon" href="test.ico" />
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" href="css.css">
|
||||
</head>
|
||||
|
||||
<h1>Morpion</h1>
|
||||
<body>
|
||||
<button id="buttons" type="button" class="btn btn-primary btn-lg">Réinitialiser / Creer partie</button>
|
||||
|
||||
<form method="post">
|
||||
<input name="rejoindre">
|
||||
<button type="submit" class="btn btn-secondary btn-lg">Rejoindre partie</button>
|
||||
</form>
|
||||
<?php
|
||||
require_once("MaDB.php");
|
||||
session_start();
|
||||
if(!isset($idpartie)){
|
||||
$idpartie = $_SESSION['idpartie'];
|
||||
}
|
||||
echo "<h2 id='ids'>Identifiant partie : <strong>$idpartie</strong></h2>";
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<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" class="btn btn-success">Inserer</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
setInterval(function(){
|
||||
$("#screen").load('ActualiserMorpion.php')
|
||||
}, 500);
|
||||
setInterval(function(){
|
||||
$("#ids").load('ActualiserIDPartie.php')
|
||||
}, 500);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="screen"></div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#buttons").click(function(){
|
||||
|
||||
$("#div1").load('SupprimerPartieActuelEtCreer.php')
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function myFunction() {
|
||||
|
||||
var copyText = document.getElementById("myInput");
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999)
|
||||
document.execCommand("copy");
|
||||
|
||||
}
|
||||
</script>
|
||||
<div id="div1"></div>
|
||||
<br>
|
||||
<button id="supp" type="button" class="btn btn-danger">Supprimer partie</button>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#supp").click(function(){
|
||||
|
||||
$("#ids").load('SupprimerPartieActuelle.php')
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
<?php
|
||||
$db = new MyDB();
|
||||
$colonne="";
|
||||
if(isset($_POST['rejoindre'])){
|
||||
$_SESSION['idpartie']=$_POST['rejoindre'];
|
||||
}
|
||||
|
||||
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'];
|
||||
}
|
||||
|
||||
|
||||
if(isset($colonne)and $valeur!="" and $colonne!=''){
|
||||
|
||||
$aff=$db->query('SELECT "'.$colonne.'" FROM partie where Id="'.$idpartie.'" ');
|
||||
$res = $aff->fetchArray();
|
||||
|
||||
if(strlen($res[$colonne])!=0){
|
||||
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.'" ');
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("MaDB.php");
|
||||
$db = new MyDB();
|
||||
|
||||
$id=$_SESSION['idpartie'];
|
||||
$requete ="DELETE FROM partie where Id='".$id."'";
|
||||
$suppression = $db->query($requete);
|
||||
|
||||
$newid=genererChaineAleatoire(10);
|
||||
$_SESSION['idpartie']=$newid;
|
||||
$db->query('INSERT INTO partie(Id) VALUES("'.$newid.'")');
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
require_once("MaDB.php");
|
||||
session_start();
|
||||
$db = new MyDB();
|
||||
$id=$_SESSION['idpartie'];
|
||||
|
||||
$requete ="DELETE FROM partie where Id='".$id."'";
|
||||
$suppression = $db->query($requete);
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
function myFunction() {
|
||||
/* Get the text field */
|
||||
var copyText = document.getElementById("myInput");
|
||||
|
||||
/* Select the text field */
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); /* For mobile devices */
|
||||
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
|
||||
/* Alert the copied text */
|
||||
alert("Copied the text: " + copyText.value);
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Loading…
Reference in new issue