Image hiding with bits
diff --git a/php/request.php b/php/request.php
index 8def47f..845cdb1 100644
--- a/php/request.php
+++ b/php/request.php
@@ -11,8 +11,8 @@
if ($_POST['msg'] == "DENY REQ") $queries = ["UPDATE users SET requested=0 WHERE id=".(int)$_POST['user_id']]; // deny request
if ($_POST['msg'] == "CONF DEAD") {
$queries = ["INSERT INTO morts (id, quimatava, assassi, curs, grau) (SELECT id, quimata, (SELECT id FROM users WHERE quimata=".(int)$_POST['user_id']."), curs, grau FROM users WHERE id=".(int)$_POST['user_id'].")", // add to 'morts'
- "UPDATE users SET requested=0, quimata=".(int)$_POST['user_quimata']." WHERE quimata=".(int)$_POST['user_id'], // assign new victim to killer
- "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_POST['user_id']]; // confirm victim dead/killed
+ "UPDATE users SET requested=0, quimata=".(int)$_POST['user_quimata'].", bits=".(int)rand(1,512)." WHERE quimata=".(int)$_POST['user_id'], // assign new victim to killer
+ "UPDATE users SET quimata=0, mort=1 WHERE id=".(int)$_POST['user_id']]; // confirm victim dead/killed
}
// Fetch the information of the user
foreach ($queries as $query) {
diff --git a/php/utils.php b/php/utils.php
index 8148c92..abd519e 100644
--- a/php/utils.php
+++ b/php/utils.php
@@ -70,6 +70,7 @@
$user->requested = (int)$row[5];
$user->mort = (int)$row[6];
$user->md5password = $row[7];
+ $user->bits = $row[8];
} else {
$user = [];
$user["id"] = (int)$row[0];
@@ -80,6 +81,7 @@
$user["requested"] = (int)$row[5];
$user["mort"] = (int)$row[6];
$user["md5password"] = $row[7];
+ $user["bits"] = $row[8];
}
array_push($users, $user);
@@ -92,4 +94,11 @@
if ($id > 0) return $users[0];
else return $users;
}
+
+ // Number n to XXXXXXXXX with X = {0,1} binary format
+ function dec2bits($code) {
+ $bits = decbin($code);
+ while (strlen($bits) < 9) $bits = '0' . $bits;
+ return $bits;
+ }
?>