mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-28 05:26:44 -05:00
Fix register process and add api key to panel
This commit is contained in:
parent
63667a5d0d
commit
8e49ffded8
@ -34,7 +34,7 @@ if (isset($_GET['do'])) {
|
||||
break;
|
||||
|
||||
case "panel":
|
||||
header('Location: ../panel');
|
||||
header('Location: ../panel/index.php');
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
|
@ -13,7 +13,7 @@ function register($user, $pass, $code)
|
||||
// Check if code is used
|
||||
if ($result['used'] == '0') {
|
||||
// Check to see if the username is in use
|
||||
$q->prepare("SELECT user FROM accounts WHERE user = (:user)");
|
||||
$q = $db->prepare("SELECT user FROM accounts WHERE user = (:user)");
|
||||
$q->bindParam(':user', $user);
|
||||
$q->execute();
|
||||
if ($q->fetchColumn() == 0) {
|
||||
@ -38,10 +38,13 @@ function register($user, $pass, $code)
|
||||
$_SESSION['id'] = $result['id'];
|
||||
$_SESSION['user'] = $user;
|
||||
$_SESSION['level'] = $result['level'];
|
||||
header('Location: api.php?do=panel');
|
||||
header('Location: http://www.shimapan.rocks/includes/api.php?do=panel');
|
||||
} else {
|
||||
header('Location: ../register/index.html#fail');
|
||||
}
|
||||
} else {
|
||||
header('Location: ../register/index.html#fail');
|
||||
}
|
||||
header('Location: ../register/index.html#fail');
|
||||
}
|
||||
|
||||
function generate($level)
|
||||
@ -208,8 +211,8 @@ function report($file, $reason)
|
||||
$q->execute();
|
||||
$result = $q->fetch();
|
||||
|
||||
if ($q->fetchColumn() != '0') {
|
||||
$q = $db->prepare("INSERT INTO reports (hash, date, file, fileid, reporter, reason) VALUES (:hash, :date, :file, :fileid, :reporter, :reason)");
|
||||
if ($q->rowCount() != '0') {
|
||||
$q = $db->prepare(" header('Location: ../register/index.html#fail');INSERT INTO reports (hash, date, file, fileid, reporter, reason) VALUES (:hash, :date, :file, :fileid, :reporter, :reason)");
|
||||
$q->bindValue(':file', strip_tags($file));
|
||||
$q->bindValue(':date', date('Y-m-d'));
|
||||
$q->bindValue(':reporter', $_SESSION['user']);
|
||||
|
@ -1,4 +1,13 @@
|
||||
{% include "../../includes/locked.swig" %}
|
||||
{% include "../../includes/header.swig" %}
|
||||
<p>Welcome, <?php echo $_SESSION['user']; ?></p>
|
||||
<?php
|
||||
require_once '../includes/database.inc.php';
|
||||
global $db;
|
||||
$q = $db->prepare("SELECT apikey FROM accounts WHERE user = (:user)");
|
||||
$q->bindValue(':user', $_SESSION['user']);
|
||||
$q->execute();
|
||||
$result = $q->fetch();
|
||||
echo 'Your API key is '.$result['apikey'];
|
||||
?>
|
||||
{% include "../../includes/footer.swig" %}
|
||||
|
Loading…
Reference in New Issue
Block a user