Compare commits
2 Commits
ba07a531d0
...
85efaca248
Author | SHA1 | Date | |
---|---|---|---|
85efaca248 | |||
39c564fb89 |
12
index.php
12
index.php
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
require("classes.php");
|
require("classes.php");
|
||||||
session_start();
|
session_start();
|
||||||
if (!array_key_exists("nbSolutions", $_SESSION)) {
|
if (!array_key_exists("sudokuGridSolutions", $_SESSION)) {
|
||||||
$_SESSION["nbSolutions"] = array();
|
$_SESSION["sudokuGridSolutions"] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullUrl = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["DOCUMENT_URI"];
|
$fullUrl = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["DOCUMENT_URI"];
|
||||||
@ -10,12 +10,12 @@
|
|||||||
$currentGrid = strip_tags($_SERVER['QUERY_STRING']);
|
$currentGrid = strip_tags($_SERVER['QUERY_STRING']);
|
||||||
|
|
||||||
if (preg_match("/^[1-9.]{81}$/", $currentGrid)) {
|
if (preg_match("/^[1-9.]{81}$/", $currentGrid)) {
|
||||||
if (!array_key_exists($currentGrid, $_SESSION["nbSolutions"])) {
|
if (!array_key_exists($currentGrid, $_SESSION["sudokuGridSolutions"])) {
|
||||||
$grid = new Grid();
|
$grid = new Grid();
|
||||||
$grid->import($currentGrid);
|
$grid->import($currentGrid);
|
||||||
$_SESSION["nbSolutions"][$currentGrid] = $grid->containsDuplicates() ? -1 : $grid->countSolutions(2);
|
$_SESSION["sudokuGridSolutions"][$currentGrid] = $grid->containsDuplicates() ? -1 : $grid->countSolutions(2);
|
||||||
}
|
}
|
||||||
switch($_SESSION["nbSolutions"][$currentGrid]) {
|
switch($_SESSION["sudokuGridSolutions"][$currentGrid]) {
|
||||||
case -1:
|
case -1:
|
||||||
$warning = "Cette grille contient des doublons.";
|
$warning = "Cette grille contient des doublons.";
|
||||||
break;
|
break;
|
||||||
@ -33,7 +33,7 @@
|
|||||||
$grid->generate();
|
$grid->generate();
|
||||||
$gridAsString = $grid->toString();
|
$gridAsString = $grid->toString();
|
||||||
$newGridUrl = "$dirUrl/?$gridAsString";
|
$newGridUrl = "$dirUrl/?$gridAsString";
|
||||||
$_SESSION["nbSolutions"][$gridAsString] = 1;
|
$_SESSION["sudokuGridSolutions"][$gridAsString] = 1;
|
||||||
if ($currentGrid) {
|
if ($currentGrid) {
|
||||||
require("400.php");
|
require("400.php");
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +30,7 @@ table.table-success input,
|
|||||||
td.table-danger input:disabled,
|
td.table-danger input:disabled,
|
||||||
table input:not([disabled]) {
|
table input:not([disabled]) {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
color: var(--bs-table-color-state,var(--bs-table-color-type,var(--bs-table-color)));
|
color: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
table input:disabled {
|
table input:disabled {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user