summaryrefslogtreecommitdiff
path: root/account/login/twitch.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-12-09 01:43:12 +0500
committerilotterytea <iltsu@alright.party>2025-12-09 01:43:12 +0500
commit29477e67ede12347b153e2255325327374e1b073 (patch)
treebe9170a20d332eab1fcc8b380f70f231921aac45 /account/login/twitch.php
parent28bb4f3618e2e947d14a05a24e99d826c26c0ce3 (diff)
feat: new configuration
Diffstat (limited to 'account/login/twitch.php')
-rw-r--r--account/login/twitch.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/account/login/twitch.php b/account/login/twitch.php
index 23f4ea5..5e61c33 100644
--- a/account/login/twitch.php
+++ b/account/login/twitch.php
@@ -3,14 +3,14 @@ include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/config.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/utils.php";
include_once "{$_SERVER['DOCUMENT_ROOT']}/lib/alert.php";
-if (!TWITCH_REGISTRATION_ENABLE) {
+if (!CONFIG['twitch']['registration']) {
generate_alert("/404.php", "Registration via Twitch is disabled", 405);
exit;
}
session_start();
-$db = new PDO(DB_URL, DB_USER, DB_PASS);
+$db = new PDO(CONFIG['database']['url'], CONFIG['database']['user'], CONFIG['database']['pass']);
if (isset($_GET["disconnect"], $_SESSION["user_id"])) {
$stmt = $db->prepare("SELECT c.id,
@@ -37,9 +37,9 @@ if (isset($_GET["disconnect"], $_SESSION["user_id"])) {
exit;
}
-$client_id = TWITCH_CLIENT_ID;
-$client_secret = TWITCH_SECRET_KEY;
-$redirect_uri = TWITCH_REDIRECT_URI;
+$client_id = CONFIG['twitch']['clientid'];
+$client_secret = CONFIG['twitch']['clientsecret'];
+$redirect_uri = CONFIG['twitch']['redirecturi'];
if (isset($_GET["error"])) {
header("Location: /account/login");
@@ -113,7 +113,7 @@ $user_name = "";
if ($row = $stmt->fetch()) {
if (isset($_SESSION["user_id"]) && $_SESSION["user_id"] != $row["id"]) {
- generate_alert("/account", "There is another " . INSTANCE_NAME . " account associated with that Twitch account", 409);
+ generate_alert("/account", "There is another " . CONFIG['instance']['name'] . " account associated with that Twitch account", 409);
exit;
}
@@ -168,7 +168,7 @@ if ($row = $stmt->fetch()) {
$_SESSION["user_id"] = $user_id;
$_SESSION["user_name"] = $user_name;
-setcookie("secret_key", $user_secret_key, time() + ACCOUNT_COOKIE_MAX_LIFETIME, "/");
+setcookie("secret_key", $user_secret_key, time() + CONFIG['account']['maxcookielifetime'], "/");
$db = null;