Vulnerability issues resolved
diff --git a/ajax/getusers.php b/ajax/getusers.php
index 30e6657..e797c7b 100644
--- a/ajax/getusers.php
+++ b/ajax/getusers.php
@@ -7,6 +7,7 @@
foreach ($users as $user) {
$nopassword = $user->md5password == "" ? "nopassword" : "";
- echo "<option class='".$nopassword."' value='".$user->id."'>".$user->nomcomplet."</option>\n";
+ $mort = $user->mort ? "disabled" : "";
+ echo "<option ".$mort." class='".$nopassword."' value='".$user->id."'>".$user->nomcomplet."</option>\n";
}
?>
diff --git a/css/main.css b/css/main.css
index 35d80b1..e4c698d 100644
--- a/css/main.css
+++ b/css/main.css
@@ -1,3 +1,7 @@
+p {
+ font-size: 16px;
+}
+
table td {
vertical-align: top;
}
diff --git a/js/utils.js b/js/utils.js
index 621bbe1..e35b5cb 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -6,6 +6,9 @@
};
function send_request(user, msg) {
+ // Check if user is alive
+ update_info(user);
+
$.ajax({
'url': './php/request.php',
'type': 'POST',
diff --git a/main.php b/main.php
index c3c3a97..54212b1 100644
--- a/main.php
+++ b/main.php
@@ -1,7 +1,20 @@
-<?php
+<?php
+ require './credentials.php';
+ require './php/utils.php';
+
if (!isset($_COOKIE['user'])) {
header("Location: ./index.php");
die();
+ } else if (isset($_COOKIE['password'])) {
+ $query_password = "SELECT password FROM users WHERE id=" . (int)$_COOKIE['user'];
+ if (query($query_password)->fetch_row()[0] != $_COOKIE['password']) {
+ // Unset variables
+ setcookie('user', '', -1, "/");
+ setcookie('password', '', -1, "/");
+
+ header("Location: ./index.php?passwordchanged=1");
+ die();
+ }
}
?>
<html>
@@ -21,8 +34,6 @@
<script src="./js/animations.js"></script>
<?php
- require './credentials.php';
- require './php/utils.php';
$user = get_users($_COOKIE['user']);
$victim = get_users($user->quimata);
if ($user->mort) header("Location: ./dead.php");
diff --git a/php/utils.php b/php/utils.php
index 1e20ebf..9a283c3 100644
--- a/php/utils.php
+++ b/php/utils.php
@@ -20,7 +20,7 @@
$conn->set_charset("utf8");
// Execute query and save result
- if (!$result = $conn->query($query)) $result = $conn->error;
+ $result = $conn->query($query);
// Close the connection
$conn->close();