Helper file and token prep

This commit is contained in:
2023-10-02 00:23:59 -04:00
parent 937278c8d5
commit 101bfd0d30
4 changed files with 50 additions and 14 deletions

View File

@@ -1,20 +1,12 @@
<?php
$config = json_decode(file_get_contents("/var/www/usergen/secret/config.json", true));
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("/var/www/usergen/secret/oauth.php");
function flog($log_msg) {
$log_filename = "/var/www/html";
$log_file_data = $log_filename.'/log_' . date('d-M-Y') . '.log';
// if you don't add `FILE_APPEND`, the file will be erased each time you add a log
file_put_contents($log_file_data, $log_msg . "\n", FILE_APPEND);
}
require_once("/var/www/usergen/secret/helpers.php");
require_once("/var/www/usergen/secret/oauth.php");
if (isset($_REQUEST["act"])){
// internal functions such as id request
flog("Ret ACT:16 ✨ ".$_REQUEST["act"]." FROM ".$_SERVER["REMOTE_ADDR"]);
switch($_REQUEST["act"]){
case "id":
// return OAUTH app ID
@@ -85,6 +77,7 @@ if (isset($_REQUEST["act"])){
}else{
// invalid auth
// TODO: Replace with direct to index logout with error msg
if(isset($_COOKIE["oa_retries"])){
$retries = $_COOKIE["oa_retries"];
if($retries >= 3){