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