implemented login.php

This commit is contained in:
Leander
2017-04-27 21:01:40 +02:00
parent 1ab6b8e763
commit 14caad8277
3 changed files with 31 additions and 0 deletions

View File

@@ -30,3 +30,7 @@
= highscores.php =
15101 - User ID not specified
15102 - User ID not existing
= login.php =
16101 - User ID not specified
16102 - User ID not existing

View File

@@ -66,6 +66,7 @@ class Database
case 13101:
case 14102:
case 15101:
case 16101:
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.';
@@ -73,6 +74,7 @@ class Database
return 'Sorry, we only have '.$values[0].' questions. Please try again.';
case 12104:
case 15102:
case 16102:
return 'The specified user name does not exist. This is an internal error.';
case 13102:
return 'No valid time specified. This is an internal error.';

View File

@@ -0,0 +1,25 @@
<?php
/**
* Created by PhpStorm.
* User: leanderschmedemann
* Date: 29/03/2017
* Time: 20:54
*/
require_once('includes.inc.php');
$data = '';
$error = 0;
$uid = isset($_GET['uid']) ? $_GET['uid'] : '';
$db = new Database();
if($uid == '') {
$error = 16101;
} else {
$uid_exists = $db->query('SELECT EXISTS FROM "Users" WHERE "ID" = $1', array($uid))['data'][0]['exists'];
if ($uid_exists == 't') {
$error = 16102;
} else {
$name = $db->query('SELECT "name" FROM "Users" WHERE "ID" = $1', array($uid))['data'][0]['name'];
}
}
?>