QWGames
QWGames
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
And the account managment done with verification
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
The remain errors about I didnt use isset(), and I think the site is working again now
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
The auth file sets the session "account_verified" true if the user enters his password and sends back the user to the manage-account file where the user datas will be send for the user and the session "account_verified" will be set to false again.
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
I fixed the original issue, I switched to get method, the problem was the Header("Location: auth"), instead this I'm redirecting the user client side:
//Send Informations To Client
else if (isset($_GET["get_info"]))
{
$verified = isset($_SESSION["account_verified"]) ? $_SESSION["account_verified"]: null;

if ($verified === true)
{
//Remove verified status after visiting this page
$_SESSION["account_verified"] = false;
}
else {
die(json_encode("auth"));
}

//Send User Information
$datas = [
"username" => $_SESSION["username"],
"email" => $_SESSION["email"],
"website" => $_SESSION["website"],
"realname" => base64_decode($_SESSION["realname"])
];

echo json_encode($datas);
exit();
}
//Send Informations To Client
else if (isset($_GET["get_info"]))
{
$verified = isset($_SESSION["account_verified"]) ? $_SESSION["account_verified"]: null;

if ($verified === true)
{
//Remove verified status after visiting this page
$_SESSION["account_verified"] = false;
}
else {
die(json_encode("auth"));
}

//Send User Information
$datas = [
"username" => $_SESSION["username"],
"email" => $_SESSION["email"],
"website" => $_SESSION["website"],
"realname" => base64_decode($_SESSION["realname"])
];

echo json_encode($datas);
exit();
}
function GetAccountInfos()
{
fetch("account_functions.php?get_info=true")
.then(response => response.json())
.then(data => {
if (data !== null)
{
//Redirect to auth
if (data === "auth")
{
window.location.href = "auth";
return;
}

//Success
document.getElementById('account_info_username').value = data["username"];
document.getElementById('account_info_website').value = data["website"];
document.getElementById('account_info_email').value = data["email"];
document.getElementById('account_info_realname').value = data["realname"];
}
})
.catch(error => {
console.error(error);
})
}
function GetAccountInfos()
{
fetch("account_functions.php?get_info=true")
.then(response => response.json())
.then(data => {
if (data !== null)
{
//Redirect to auth
if (data === "auth")
{
window.location.href = "auth";
return;
}

//Success
document.getElementById('account_info_username').value = data["username"];
document.getElementById('account_info_website').value = data["website"];
document.getElementById('account_info_email').value = data["email"];
document.getElementById('account_info_realname').value = data["realname"];
}
})
.catch(error => {
console.error(error);
})
}
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
Thank you
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
yes I understand. I will try to fix the issues. Thanks for the tips.
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
By the way its not working with $_GET or $_REQUEST, too
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
Yeah, my JS file is the same. A lot of request functions to the server. I would probably need to make multiple files for each request.
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
So I cant get response from a post request?
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
yeah but I dont understand, beacuse these files worked before
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
my file name is account_functions.php
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
I didnt see these are different files, but they are
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
The other error is
[21-Dec-2023 12:58:43 UTC] PHP Warning: Undefined array key "query" in /home/u/domains/qwgamers.net/public_html/get_titles.php on line 5
[21-Dec-2023 12:58:43 UTC] PHP Warning: Undefined array key "query" in /home/u/domains/qwgamers.net/public_html/get_titles.php on line 5
line 5:
$query = $_GET["query"] ? $_GET["query"]: null;
$query = $_GET["query"] ? $_GET["query"]: null;
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
So its saying
[21-Dec-2023 12:49:56 UTC] PHP Warning: Undefined array key "username" in /home//domains/qwgamers.net/public_html/session_info.php on line 9
[21-Dec-2023 12:49:56 UTC] PHP Warning: Undefined array key "email" in /home/u/domains/qwgamers.net/public_html/session_info.php on line 10
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "website" in /home/u/domains/qwgamers.net/public_html/login.php on line 108
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "first_name" in /home/u/domains/qwgamers.net/public_html/login.php on line 109
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "last_name" in /home/u/domains/qwgamers.net/public_html/login.php on line 109
[21-Dec-2023 12:49:56 UTC] PHP Warning: Undefined array key "username" in /home//domains/qwgamers.net/public_html/session_info.php on line 9
[21-Dec-2023 12:49:56 UTC] PHP Warning: Undefined array key "email" in /home/u/domains/qwgamers.net/public_html/session_info.php on line 10
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "website" in /home/u/domains/qwgamers.net/public_html/login.php on line 108
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "first_name" in /home/u/domains/qwgamers.net/public_html/login.php on line 109
[21-Dec-2023 12:50:03 UTC] PHP Warning: Undefined array key "last_name" in /home/u/domains/qwgamers.net/public_html/login.php on line 109
I think the problem is with the session variables, and I don't know how, but another php file is having the same problem now.
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
I think I have to wait a couple of minutes to process the changes, beacuse I think my php files are not working now.
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
I enabled error logs for php
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
an empty 200 response
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
nothing
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
Error logs are disabled for my php configuration. how can I enable it?
49 replies
KPCKevin Powell - Community
Created by QWGames on 12/21/2023 in #back-end
Unexpected end of json input
It's returning the same error if I set the verified variable true
49 replies