$content = guest_credits(); } elseif ($p == "imprint") { require_once realpath(__DIR__ . '/../includes/pages/guest_imprint.php'); $title = credits_title(); $content = guest_credits(); } elseif ($p == "privacy") { require_once realpath(__DIR__ . '/../includes/pages/guest_privacy.php'); $title = credits_title(); $content = guest_credits(); } elseif ($p === "dashboard") { require_once realpath(__DIR__ . '/../includes/pages/dashboard.php'); $title = getDashboardTitle(); $content = get_dashboard(); } elseif ($p == "api_key") { require_once realpath(__DIR__ . '/../includes/controller/api_key.php'); $content = getAPIKey(); } else { require_once realpath(__DIR__ . '/../includes/pages/guest_start.php'); $content = guest_start(); } } else { // Wenn schon eingeloggt, keine-Berechtigung-Seite anzeigen if (isset($user)) { $title = _("No Access"); $content = _("You don't have permission to view this page. You probably have to sign in or register in order to gain access!"); } else { // Sonst zur Loginseite leiten redirect(page_link_to("login")); } } echo template_render('../templates/layout.html', array('theme' => isset($user) ? $user['color'] : $default_theme, 'title' => $title, 'atom_link' => $p == 'news' || $p == 'user_meetings' ? '<link href="' . page_link_to('atom') . ($p == 'user_meetings' ? '&meetings=1' : '') . '&key=' . $user['api_key'] . '" type="application/atom+xml" rel="alternate" title="Atom Feed">' : '', 'menu' => make_menu(), 'content' => msg() . $content, 'privacy_note' => PN_ShowNotice(), 'header_toolbar' => header_toolbar(), 'faq_url' => $faq_url, 'locale' => locale(), 'selectAllText' => _('Select all'), 'filterPlaceholder' => _("Search"), 'allSelectedText' => _("All selected"), 'nSelectedText' => _("selected"), 'nonSelectedText' => _("None selected")));
<th>Key</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>name</td> <td><?php echo getGameName(); ?> </td> </tr> <tr> <td>apikey</td> <td><?php echo getAPIKey(); ?> </td> </tr> <tr> <td>numachievements</td> <td><?php echo getNumAchievements(); ?> </td> </tr> <tr> <td>numleaderboards</td> <td><?php echo getNumLeaderboards(); ?>
public function addUser($email, $pass, $level) { $email = pg_escape_string($this->conn, $email); $pass = pg_escape_string($this->conn, $pass); $level = pg_escape_string($this->conn, $level); $sql = "SELECT * FROM users WHERE email = '{$email}' LIMIT 1"; $query = pg_query($this->conn, $sql) or die(pg_last_error($this->conn)); if (pg_num_rows($query) <= 0) { $hash = getHashed($pass); $api_key = getAPIKey(); $sql = "INSERT INTO users (email, pass, level, api_key) VALUES ('{$email}', '{$hash}', '{$level}', '{$api_key}') RETURNING _id;"; $query = pg_query($this->conn, $sql); if ($query) { $insert_row = pg_fetch_row($query); $insert_id = $insert_row[0]; json_return(200, "User Add Succeeded", array("_id" => $insert_id)); } else { json_return(400, "Something Went Wrong", NULL); } } else { json_return(200, "User Already Exists", NULL); } }
public function addUser($email, $pass) { $email = mysqli_real_escape_string($this->conn, $email); $pass = mysqli_real_escape_string($this->conn, $pass); $sql = "SELECT * FROM `users` WHERE `email` = '{$email}' LIMIT 1"; $query = mysqli_query($this->conn, $sql) or die(mysqli_errno($this->conn)); if (mysqli_num_rows($query) <= 0) { $hash = getHashed($pass); $api_key = getAPIKey(); $sql = "INSERT INTO `users` (`email`, `pass`, `level`, `api_key`) VALUES ('{$email}', '{$hash}', '2', '{$api_key}')"; $query = mysqli_query($this->conn, $sql); if ($query) { json_return(200, "User Add Succeeded", array("_id" => mysqli_insert_id($this->conn))); } else { json_return(400, "Something Went Wrong", NULL); } } else { json_return(200, "User Already Exists", NULL); } }