T201704081225

This commit is contained in:
Leander
2017-04-06 12:25:29 +02:00
parent e049fc20de
commit fe25b75498
3 changed files with 16 additions and 0 deletions

View File

@@ -24,3 +24,6 @@
= rename.php =
14101 - User name doesn't match rules
14102 - User name already exists
= highscores.php =
15101 - User ID not specified

View File

@@ -64,6 +64,7 @@ class Database
return 'User name already exists. Please pick a different name.';
case 12101:
case 13101:
case 15101:
return 'User ID not specified. This is an internal error.';
case 12102:
return 'A game without a question is not possible. Please select new game length.';

View File

@@ -10,6 +10,7 @@ require_once('includes.inc.php');
$data = '';
$error = 0;
$uid = isset($_GET['uid']) ? $_GET['uid'] : '';
$db = new Database();
$categories[] = array('id' => 1, 'name' => "BWL", 'score' => 321, 'place' => 123);
$categories[] = array('id' => 2, 'name' => "Mathematik", 'score' => 1454, 'place' => 1);
@@ -18,4 +19,15 @@ $info = array('score' => 3253, 'place' => 122, 'all' => 321, 'categories' => $ca
$response = Database::create_response($info, $error);
print_r($response);
if($uid == '') {
$error = 15101;
} else if($db->query('SELECT EXISTS (SELECT 1 FROM "Users" WHERE "ID" = $1)', array($uid))
['data']['0']['exists'] == 'f') {
$score = $db->query('SELECT "highscore" FROM "Users" WHERE "ID" = $1', array($uid))['data'][0]['highscore'];
$all = $db->query('SELECT COUNT (*) FROM "Users"')['data']['0']['count'];
print 'Score: '.$score;
print 'All: '.$all;
}
?>