code restructured

This commit is contained in:
Leander
2017-05-01 21:01:54 +02:00
parent 2fef4dc157
commit aa4fe851d0
9 changed files with 338 additions and 96 deletions

View File

@@ -9,17 +9,30 @@
require_once('includes.inc.php');
$data = '';
$error = 0;
$uid = isset($_GET['uid']) ? $_GET['uid'] : '';
$uid = isset($_GET['uid']) ?
$_GET['uid'] : '';
$db = new Database();
if($uid == '') {
$error = 16101;
} else {
$uid_exists = $db->query('SELECT EXISTS (SELECT 1 FROM "Users" WHERE "ID" = $1)', array($uid))['data'][0]['exists'];
$uid_exists = $db->query(
'SELECT EXISTS (
SELECT 1
FROM "Users"
WHERE "ID" = $1
)',
array($uid)
)['data'][0]['exists'];
if ($uid_exists == 'f') {
$error = 16102;
} else {
$name = $db->query('SELECT "name" FROM "Users" WHERE "ID" = $1', array($uid))['data'][0]['name'];
$name = $db->query(
'SELECT "name"
FROM "Users"
WHERE "ID" = $1',
array($uid)
)['data'][0]['name'];
$data = array('uid' => $uid, 'name' => $name);
}
}