Editer Score = strtoupper($team) ?>
++ = $description ?> +
+= strtoupper($team) ?> | +||
---|---|---|
Log | +Points | ++ |
+ +
diff --git a/assets/css/stats.css b/assets/css/stats.css index f0b0937..8ff3d49 100644 --- a/assets/css/stats.css +++ b/assets/css/stats.css @@ -75,4 +75,116 @@ .stats-table { width: 100%; } +} + +.edit-button-container { + border: none; +} + +.edit-button { + width: auto; + background: #fafafa; + color: #000; + border-radius: 5px; + padding: 5px; + box-shadow: 0 0 5px #000000; +} + +.edit-button:hover { + color: #fafafa; +} + +#button-urss:hover { + background: #ee293d; +} + +#button-usa:hover { + background: #1a5dad; +} + +.stats-button-container { + display: inline-flex; +} + +.stats-button { + width: auto; + background: #fafafa; + color: #000; + border-radius: 5px; + padding: 15px; + box-shadow: 0 0 5px #000000; +} + +.stats-button:hover { + color: #fafafa; + background: #1a1a1a; +} + +.edit-stats { + width: 100%; +} + +input { + text-align: center; + background: #1a1a1a; + color: #fafafa; + width: 100%; + border: none; + font-family: inherit; + font-size: inherit; +} + +.remove-line { + color: #ff1200; + cursor: pointer; + transition: 0.3s; +} + +.remove-line svg { + pointer-events: none; +} + +.remove-line:hover { + color: #ff4000; +} + +.add-line{ + font-size: 30px; + color: #fafafa; + cursor: pointer; + transition: 0.3s; + margin: 1% 1% 1% 1%; + width: 100%; + border-radius: 5px; +} + +#add-line-usa { + background: #3a7eaa; +} + +.add-line#add-line-usa:hover { + background: #53bbfc; +} + +#add-line-urss { + background: #d72229; +} + +.add-line#add-line-urss:hover { + background: #ee293d; +} + +.save-score { + background: #21aa08; + font-size: 30px; + color: #fafafa; + cursor: pointer; + transition: 0.3s; + margin: 30px 1% 1% 1%; + width: 100%; + border-radius: 5px; +} + +.save-score:hover { + background: #2ce20b; } \ No newline at end of file diff --git a/classes/dao.php b/classes/dao.php new file mode 100644 index 0000000..01b5279 --- /dev/null +++ b/classes/dao.php @@ -0,0 +1,53 @@ +read_password($path_to_password); + $dsn = 'mysql:dbname=accueil_insa;host=127.0.0.1'; + try { + $this->conn = new PDO($dsn, $username, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']); + } + catch (PDOException $e){ + die($e->getMessage()); + } + } + + private function read_password($path_to_password){ + $file = fopen($path_to_password."includes/.htpassdb", "r") or die("Unable to open file!");; + $password = fgets($file); + fclose($file); + return $password; + } + + public function get_score_team($team){ + $sql = 'SELECT text, points FROM scores WHERE team = ?'; + $cursor = $this->conn->prepare($sql); + $cursor->execute([$team]); + return $cursor->fetchAll(PDO::FETCH_ASSOC); + } + + public function save_scores($scores_json, $team){ +// var_dump($scores_json); +// var_dump($team); + $sql = 'DELETE FROM scores WHERE team = ?'; + $cursor = $this->conn->prepare($sql); + $cursor->execute([$team]); + + $array = json_decode($scores_json)->array; + foreach ($array as $value){ + $sql = 'INSERT INTO scores (text, points, team) VALUES (?, ?, ?)'; + $cursor = $this->conn->prepare($sql); + $cursor->execute([$value->text, $value->points, $team]); + } + + } + +} + + + diff --git a/edit_score/.htaccess b/edit_score/.htaccess new file mode 100644 index 0000000..5a928f6 --- /dev/null +++ b/edit_score/.htaccess @@ -0,0 +1 @@ +Options -Indexes diff --git a/edit_score/edit_template.php b/edit_score/edit_template.php new file mode 100644 index 0000000..2114095 --- /dev/null +++ b/edit_score/edit_template.php @@ -0,0 +1,114 @@ + + + +
+ + + + + + + + + + + + + + ++ = $description ?> +
+= strtoupper($team) ?> | +||
---|---|---|
Log | +Points | ++ |
- Les stats de la semaine.
-
- Remporte le plus de points possible pour faire gagner ton équipe, mais attention à ne pas lui en faire perdre !
-
USA | -|
---|---|
Log | -Points | -
URSS | -|
---|---|
Log | -Points | -
+ Les stats de la semaine.
+
+ Remporte le plus de points possible pour faire gagner ton équipe, mais attention à ne pas lui en faire perdre !
+
+ + Éditer les scores + + | +|
USA | +|
---|---|
Log | +Points | +
+ + Éditer les scores + + | +|
URSS | +|
---|---|
Log | +Points | +
- Make INSA great again! -
-- You have joined the greatest nation on the surface of the earth, and you will help us conquer outer space! As a - young patriot, your mission, if you choose to accept it, is to crush the Reds under the command of the most - competent General of the US! -
-- Join the fight at Facebook, and ask to join the - special forces. -
-- Here is your General -
-+ Make INSA great again! +
++ You have joined the greatest nation on the surface of the earth, and you will help us conquer outer space! As a + young patriot, your mission, if you choose to accept it, is to crush the Reds under the command of the most + competent General of the US! +
++ Join the fight at Facebook, and ask to join the + special forces. +
++ Here is your General +
+