mirror of
https://github.com/Foltik/Shimapan
synced 2025-02-26 08:56:19 -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;
|
break;
|
||||||
|
|
||||||
case "panel":
|
case "panel":
|
||||||
header('Location: ../panel');
|
header('Location: ../panel/index.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "delete":
|
case "delete":
|
||||||
|
@ -13,7 +13,7 @@ function register($user, $pass, $code)
|
|||||||
// Check if code is used
|
// Check if code is used
|
||||||
if ($result['used'] == '0') {
|
if ($result['used'] == '0') {
|
||||||
// Check to see if the username is in use
|
// 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->bindParam(':user', $user);
|
||||||
$q->execute();
|
$q->execute();
|
||||||
if ($q->fetchColumn() == 0) {
|
if ($q->fetchColumn() == 0) {
|
||||||
@ -38,11 +38,14 @@ function register($user, $pass, $code)
|
|||||||
$_SESSION['id'] = $result['id'];
|
$_SESSION['id'] = $result['id'];
|
||||||
$_SESSION['user'] = $user;
|
$_SESSION['user'] = $user;
|
||||||
$_SESSION['level'] = $result['level'];
|
$_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');
|
header('Location: ../register/index.html#fail');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
header('Location: ../register/index.html#fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generate($level)
|
function generate($level)
|
||||||
{
|
{
|
||||||
@ -208,8 +211,8 @@ function report($file, $reason)
|
|||||||
$q->execute();
|
$q->execute();
|
||||||
$result = $q->fetch();
|
$result = $q->fetch();
|
||||||
|
|
||||||
if ($q->fetchColumn() != '0') {
|
if ($q->rowCount() != '0') {
|
||||||
$q = $db->prepare("INSERT INTO reports (hash, date, file, fileid, reporter, reason) VALUES (:hash, :date, :file, :fileid, :reporter, :reason)");
|
$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(':file', strip_tags($file));
|
||||||
$q->bindValue(':date', date('Y-m-d'));
|
$q->bindValue(':date', date('Y-m-d'));
|
||||||
$q->bindValue(':reporter', $_SESSION['user']);
|
$q->bindValue(':reporter', $_SESSION['user']);
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
{% include "../../includes/locked.swig" %}
|
{% include "../../includes/locked.swig" %}
|
||||||
{% include "../../includes/header.swig" %}
|
{% include "../../includes/header.swig" %}
|
||||||
<p>Welcome, <?php echo $_SESSION['user']; ?></p>
|
<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" %}
|
{% include "../../includes/footer.swig" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user