blob: ac2c8cffc42598a7a2cbd3d44ed4ae523149a3df [file] [log] [blame]
Andreu66ad5cf2019-09-18 17:15:44 +02001<?php
Andreu2457e402019-09-22 00:52:41 +02002 require '../credentials.php';
Andreu20cbd1d2019-09-22 00:00:57 +02003 require 'utils.php';
Andreu66ad5cf2019-09-18 17:15:44 +02004
Andreu20af6c22019-09-24 18:33:50 +02005 $credentials = new Credentials();
6 $usersdb = $credentials->usersdb;
7 $mortsdb = $credentials->mortsdb;
8
Andreu66ad5cf2019-09-18 17:15:44 +02009 // Do the query
Andreuefe66eb2019-09-21 18:41:49 +020010 $queries = [""];
Andreu20af6c22019-09-24 18:33:50 +020011 $victimid = "ANY (SELECT quimata FROM (SELECT * FROM $usersdb) AS victims WHERE id=".(int)$_POST['user_id'].")";
Andreuabbcb7e2019-09-21 18:22:14 +020012
Andreu20af6c22019-09-24 18:33:50 +020013 if ($_POST['msg'] == "REQ KILL") $queries = ["UPDATE $usersdb SET requested=1 WHERE id=".$victimid]; // request kill
14 if ($_POST['msg'] == "REQ DEAD") $queries = ["UPDATE $usersdb SET requested=2 WHERE quimata=".(int)$_POST['user_id']]; // request dead
15 if ($_POST['msg'] == "DENY REQ") $queries = ["UPDATE $usersdb SET requested=0 WHERE id=".(int)$_POST['user_id']]; // deny request
Andreu09b8b052019-09-21 21:47:20 +020016 if ($_POST['msg'] == "CONF DEAD") {
Andreu20af6c22019-09-24 18:33:50 +020017 $queries = ["INSERT INTO $mortsdb (id, quimatava, assassi, curs, grau) (SELECT id, quimata, (SELECT id FROM $usersdb WHERE quimata=".(int)$_POST['user_id']."), curs, grau FROM $usersdb WHERE id=".(int)$_POST['user_id'].")", // add to 'morts'
18 "UPDATE $usersdb SET requested=0, quimata=".(int)$_POST['user_quimata'].", bits=".(int)rand(1,512)." WHERE quimata=".(int)$_POST['user_id'], // assign new victim to killer
19 "UPDATE $usersdb SET quimata=0, mort=1 WHERE id=".(int)$_POST['user_id']]; // confirm victim dead/killed
Andreu885889c2019-09-19 00:28:20 +020020 }
Andreu66ad5cf2019-09-18 17:15:44 +020021 // Fetch the information of the user
Andreuefe66eb2019-09-21 18:41:49 +020022 foreach ($queries as $query) {
Andreu20cbd1d2019-09-22 00:00:57 +020023 if ($query != "" and $result = query($query)) echo $query;
Andreu04f79ef2019-09-22 18:52:19 +020024 else die("Query failed: " . $query);
Andreuefe66eb2019-09-21 18:41:49 +020025 }
Andreu66ad5cf2019-09-18 17:15:44 +020026?>