Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed code style #858

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptGJFriendRequest20.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

include "incl/relationships/acceptGJFriendRequest.php";
?>
2 changes: 1 addition & 1 deletion accounts/accountManagement.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

header("Location: ../tools");
?>
102 changes: 50 additions & 52 deletions accounts/backupGJAccount.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

chdir(dirname(__FILE__));
set_time_limit(0);
ini_set("memory_limit","128M");
ini_set("post_max_size","50M");
ini_set("upload_max_filesize","50M");
ini_set("memory_limit", "128M");
ini_set("post_max_size", "50M");
ini_set("upload_max_filesize", "50M");
include "../config/security.php";
include "../incl/lib/connection.php";
require "../incl/lib/generatePass.php";
Expand All @@ -18,53 +19,50 @@
$saveData = ExploitPatch::remove($_POST["saveData"]);
$pass = GeneratePass::isValidUsrname($userName, $password);
if ($pass == 1) {
$saveDataArr = explode(";",$saveData); //splitting ccgamemanager and cclocallevels
$saveData = str_replace("-","+",$saveDataArr[0]); //decoding
$saveData = str_replace("_","/",$saveData);
$saveData = base64_decode($saveData);
$saveData = gzdecode($saveData);
$orbs = explode("</s><k>14</k><s>",$saveData)[1];
$orbs = explode("</s>",$orbs)[0];
$lvls = explode("<k>GS_value</k>",$saveData)[1];
$lvls = explode("</s><k>4</k><s>",$lvls)[1];
$lvls = explode("</s>",$lvls)[0];
$protected_key_encoded = "";
//if($cloudSaveEncryption == 0){
$saveData = str_replace("<k>GJA_002</k><s>".$password."</s>", "<k>GJA_002</k><s>password</s>", $saveData); //replacing pass
//file_put_contents($userName, $saveData);
$saveData = gzencode($saveData); //encoding back
$saveData = base64_encode($saveData);
$saveData = str_replace("+","-",$saveData);
$saveData = str_replace("/","_",$saveData);
$saveData = $saveData . ";" . $saveDataArr[1]; //merging ccgamemanager and cclocallevels
/*}else if($cloudSaveEncryption == 1){
$saveData = ExploitPatch::remove($_POST["saveData"]);
$protected_key = KeyProtectedByPassword::createRandomPasswordProtectedKey($password);
$protected_key_encoded = $protected_key->saveToAsciiSafeString();
$user_key = $protected_key->unlockKey($password);
$saveData = Crypto::encrypt($saveData, $user_key);
}*/
//$query = $db->prepare("UPDATE `accounts` SET `saveData` = :saveData WHERE userName = :userName");
//$query->execute([':saveData' => $saveData, ':userName' => $userName]);
$query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName");
$query->execute([':userName' => $userName]);
$accountID = $query->fetchColumn();
if(!is_numeric($accountID)){
exit("-1");
}
file_put_contents("../data/accounts/$accountID",$saveData);
file_put_contents("../data/accounts/keys/$accountID","");
$query = $db->prepare("SELECT extID FROM users WHERE userName = :userName LIMIT 1");
$query->execute([':userName' => $userName]);
$result = $query->fetchAll();
$result = $result[0];
$extID = $result["extID"];
$query = $db->prepare("UPDATE `users` SET `orbs` = :orbs, `completedLvls` = :lvls WHERE extID = :extID");
$query->execute([':orbs' => $orbs, ':extID' => $extID, ':lvls' => $lvls]);
echo "1";
$saveDataArr = explode(";", $saveData); //splitting ccgamemanager and cclocallevels
$saveData = str_replace("-", "+", $saveDataArr[0]); //decoding
$saveData = str_replace("_", "/", $saveData);
$saveData = base64_decode($saveData);
$saveData = gzdecode($saveData);
$orbs = explode("</s><k>14</k><s>", $saveData)[1];
$orbs = explode("</s>", $orbs)[0];
$lvls = explode("<k>GS_value</k>", $saveData)[1];
$lvls = explode("</s><k>4</k><s>", $lvls)[1];
$lvls = explode("</s>", $lvls)[0];
$protected_key_encoded = "";
//if($cloudSaveEncryption == 0){
$saveData = str_replace("<k>GJA_002</k><s>".$password."</s>", "<k>GJA_002</k><s>password</s>", $saveData); //replacing pass
//file_put_contents($userName, $saveData);
$saveData = gzencode($saveData); //encoding back
$saveData = base64_encode($saveData);
$saveData = str_replace("+", "-", $saveData);
$saveData = str_replace("/", "_", $saveData);
$saveData = $saveData . ";" . $saveDataArr[1]; //merging ccgamemanager and cclocallevels
/*}else if($cloudSaveEncryption == 1){
$saveData = ExploitPatch::remove($_POST["saveData"]);
$protected_key = KeyProtectedByPassword::createRandomPasswordProtectedKey($password);
$protected_key_encoded = $protected_key->saveToAsciiSafeString();
$user_key = $protected_key->unlockKey($password);
$saveData = Crypto::encrypt($saveData, $user_key);
}*/
//$query = $db->prepare("UPDATE `accounts` SET `saveData` = :saveData WHERE userName = :userName");
//$query->execute([':saveData' => $saveData, ':userName' => $userName]);
$query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName");
$query->execute([':userName' => $userName]);
$accountID = $query->fetchColumn();
if (!is_numeric($accountID)) {
exit("-1");
}
file_put_contents("../data/accounts/$accountID", $saveData);
file_put_contents("../data/accounts/keys/$accountID", "");
$query = $db->prepare("SELECT extID FROM users WHERE userName = :userName LIMIT 1");
$query->execute([':userName' => $userName]);
$result = $query->fetchAll();
$result = $result[0];
$extID = $result["extID"];
$query = $db->prepare("UPDATE `users` SET `orbs` = :orbs, `completedLvls` = :lvls WHERE extID = :extID");
$query->execute([':orbs' => $orbs, ':extID' => $extID, ':lvls' => $lvls]);
echo "1";
} else {
echo -1;
}
else
{
echo -1;
}
?>
60 changes: 30 additions & 30 deletions accounts/loginGJAccount.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

include "../incl/lib/connection.php";
require "../incl/lib/generatePass.php";
require_once "../incl/lib/exploitPatch.php";
Expand All @@ -12,49 +13,48 @@
//registering
$query = $db->prepare("SELECT accountID FROM accounts WHERE userName LIKE :userName");
$query->execute([':userName' => $userName]);
if($query->rowCount() == 0){
exit("-1");
if ($query->rowCount() == 0) {
exit("-1");
}
$id = $query->fetchColumn();
//rate limiting
$newtime = time() - 3600;
/*$query6 = $db->prepare("SELECT count(*) FROM actions WHERE type = '1' AND timestamp > :time AND value2 = :ip");
$query6->execute([':time' => $newtime, ':ip' => $ip]);
if($query6->fetchColumn() > 5){
exit("-12");
exit("-12");
}*/
//authenticating
$pass = GeneratePass::isValidUsrname($userName, $password);
if ($pass == 1) { //success
//userID
$query2 = $db->prepare("SELECT userID FROM users WHERE extID = :id");
//userID
$query2 = $db->prepare("SELECT userID FROM users WHERE extID = :id");

$query2->execute([':id' => $id]);
if ($query2->rowCount() > 0) {
$userID = $query2->fetchColumn();
} else {
$query = $db->prepare("INSERT INTO users (isRegistered, extID, userName)
$query2->execute([':id' => $id]);
if ($query2->rowCount() > 0) {
$userID = $query2->fetchColumn();
} else {
$query = $db->prepare("INSERT INTO users (isRegistered, extID, userName)
VALUES (1, :id, :userName)");

$query->execute([':id' => $id, ':userName' => $userName]);
$userID = $db->lastInsertId();
}
//logging
$query6 = $db->prepare("INSERT INTO actions (type, value, timestamp, value2) VALUES
$query->execute([':id' => $id, ':userName' => $userName]);
$userID = $db->lastInsertId();
}
//logging
$query6 = $db->prepare("INSERT INTO actions (type, value, timestamp, value2) VALUES
('2',:username,:time,:ip)");
$query6->execute([':username' => $userName, ':time' => time(), ':ip' => $ip]);
//result
echo $id.",".$userID;
if(!is_numeric($udid)){
$query2 = $db->prepare("SELECT userID FROM users WHERE extID = :udid");
$query2->execute([':udid' => $udid]);
$usrid2 = $query2->fetchColumn();
$query2 = $db->prepare("UPDATE levels SET userID = :userID, extID = :extID WHERE userID = :usrid2");
$query2->execute([':userID' => $userID, ':extID' => $id, ':usrid2' => $usrid2]);
}
}elseif ($pass == -1){ //failure
echo -12;
}else{
echo -1;
$query6->execute([':username' => $userName, ':time' => time(), ':ip' => $ip]);
//result
echo $id.",".$userID;
if (!is_numeric($udid)) {
$query2 = $db->prepare("SELECT userID FROM users WHERE extID = :udid");
$query2->execute([':udid' => $udid]);
$usrid2 = $query2->fetchColumn();
$query2 = $db->prepare("UPDATE levels SET userID = :userID, extID = :extID WHERE userID = :usrid2");
$query2->execute([':userID' => $userID, ':extID' => $id, ':usrid2' => $usrid2]);
}
} elseif ($pass == -1) { //failure
echo -12;
} else {
echo -1;
}
?>
49 changes: 25 additions & 24 deletions accounts/registerGJAccount.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
<?php

include "../config/security.php";
include "../incl/lib/connection.php";
require_once "../incl/lib/exploitPatch.php";

if(!isset($preactivateAccounts)){
$preactivateAccounts = true;
if (!isset($preactivateAccounts)) {
$preactivateAccounts = true;
}

if($_POST["userName"] != ""){
//here im getting all the data
$userName = ExploitPatch::remove($_POST["userName"]);
$password = ExploitPatch::remove($_POST["password"]);
$email = ExploitPatch::remove($_POST["email"]);
$secret = "";
//checking if username is within the GD length limit
if(strlen($userName) > 20)
exit("-4");
//checking if name is taken
$query2 = $db->prepare("SELECT count(*) FROM accounts WHERE userName LIKE :userName");
$query2->execute([':userName' => $userName]);
$regusrs = $query2->fetchColumn();
if ($regusrs > 0) {
echo "-2";
}else{
$hashpass = password_hash($password, PASSWORD_DEFAULT);
$query = $db->prepare("INSERT INTO accounts (userName, password, email, registerDate, isActive)
if ($_POST["userName"] != "") {
//here im getting all the data
$userName = ExploitPatch::remove($_POST["userName"]);
$password = ExploitPatch::remove($_POST["password"]);
$email = ExploitPatch::remove($_POST["email"]);
$secret = "";
//checking if username is within the GD length limit
if (strlen($userName) > 20) {
exit("-4");
}
//checking if name is taken
$query2 = $db->prepare("SELECT count(*) FROM accounts WHERE userName LIKE :userName");
$query2->execute([':userName' => $userName]);
$regusrs = $query2->fetchColumn();
if ($regusrs > 0) {
echo "-2";
} else {
$hashpass = password_hash($password, PASSWORD_DEFAULT);
$query = $db->prepare("INSERT INTO accounts (userName, password, email, registerDate, isActive)
VALUES (:userName, :password, :email, :time, :isActive)");
$query->execute([':userName' => $userName, ':password' => $hashpass, ':email' => $email, ':time' => time(), ':isActive' => $preactivateAccounts ? 1 : 0]);
echo "1";
}
$query->execute([':userName' => $userName, ':password' => $hashpass, ':email' => $email, ':time' => time(), ':isActive' => $preactivateAccounts ? 1 : 0]);
echo "1";
}
}
?>
2 changes: 1 addition & 1 deletion accounts/syncGJAccount.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

include "syncGJAccount20.php";
?>
49 changes: 25 additions & 24 deletions accounts/syncGJAccount20.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

chdir(dirname(__FILE__));
//error_reporting(0);
include "../incl/lib/connection.php";
Expand All @@ -9,34 +10,34 @@
use Defuse\Crypto\KeyProtectedByPassword;
use Defuse\Crypto\Crypto;
use Defuse\Crypto\Key;

//here im getting all the data
$userName = ExploitPatch::remove($_POST["userName"]);
$password = $_POST["password"];
$secret = "";
$pass = GeneratePass::isValidUsrname($userName, $password);
if ($pass == 1) {
$query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName");
$query->execute([':userName' => $userName]);
$accountID = $query->fetchColumn();
if(!is_numeric($accountID) || !file_exists("../data/accounts/$accountID")){
exit("-1");
}else{
$saveData = file_get_contents("../data/accounts/$accountID");
if(file_exists("../data/accounts/keys/$accountID") && substr($saveData,0,3) != "H4s"){
$protected_key_encoded = file_get_contents("../data/accounts/keys/$accountID");
$protected_key = KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
$user_key = $protected_key->unlockKey($password);
try {
$saveData = Crypto::decrypt($saveData, $user_key);
file_put_contents("../data/accounts/$accountID",$saveData);
file_put_contents("../data/accounts/keys/$accountID","");
} catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
exit("-3");
}
}
}
echo $saveData.";21;30;a;a";
}else{
echo -2;
$query = $db->prepare("SELECT accountID FROM accounts WHERE userName = :userName");
$query->execute([':userName' => $userName]);
$accountID = $query->fetchColumn();
if (!is_numeric($accountID) || !file_exists("../data/accounts/$accountID")) {
exit("-1");
} else {
$saveData = file_get_contents("../data/accounts/$accountID");
if (file_exists("../data/accounts/keys/$accountID") && substr($saveData, 0, 3) != "H4s") {
$protected_key_encoded = file_get_contents("../data/accounts/keys/$accountID");
$protected_key = KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
$user_key = $protected_key->unlockKey($password);
try {
$saveData = Crypto::decrypt($saveData, $user_key);
file_put_contents("../data/accounts/$accountID", $saveData);
file_put_contents("../data/accounts/keys/$accountID", "");
} catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
exit("-3");
}
}
}
echo $saveData.";21;30;a;a";
} else {
echo -2;
}
?>
2 changes: 1 addition & 1 deletion blockGJUser20.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

include "incl/relationships/blockGJUser.php";
?>
2 changes: 1 addition & 1 deletion config/connection.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$servername = "127.0.0.1";
$port = 3306;
$username = "root";
$password = "";
$dbname = "geometrydash";
?>
5 changes: 2 additions & 3 deletions config/dailyChests.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/*
QUESTS
QUESTS
*/
//NOW SET IN THE QUESTS TABLE IN THE MYSQL DATABASE
/*
REWARDS
REWARDS
*/
//SMALL CHEST
$chest1minOrbs = 200;
Expand All @@ -25,4 +25,3 @@
//REWARD TIMES (in seconds)
$chest1wait = 3600;
$chest2wait = 14400;
?>
2 changes: 1 addition & 1 deletion config/discord.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

$discordEnabled = false;
$secret = "please change this if you intend to use a discord bot with the server";
$bottoken = "please change this to a discord bot token if you use one";
?>
Loading