if ($magicEffect <= 0) { $magicEffect = 0; } if ($magic->getType() == "Health") { $characterHP += $magicEffect - $totalDamageMonster; echo "{$battle29} {$magicEffect}<br>"; if ($characterHP > $characterHPMax) { $characterHP = $characterHPMax; } } elseif ($magic->getType() == "Attack") { $characterHP -= $totalDamageMonster; $monsterHP -= $magicEffect; echo "{$battle17} {$magicEffect}<br>"; } $characterMP = $characterMP - $magic->getMPCost(); updateAccount($bdd, $characterHP, $characterMP, $characterID); updateBattleMonster($bdd, $monsterID, $monsterPicture, $monsterName, $monsterDescription, $monsterLevel, $monsterHP, $monsterMP, $monsterStrength, $monsterMagic, $monsterAgility, $monsterDefense, $monsterExperience, $monsterGold, $battle['Battle_List_ID']); ?> <?php echo $battle11 . ' ' . $totalDamageMonster; ?> <hr> <form method="POST" action="index.php"> <input type="submit" class="btn btn-success" name="Continue" value="<?php echo $battle12; ?> "> </form> </div> </div> <?php
//array of (username, email, name) if ($club_id > 0) { if (isset($_REQUEST['old_password'])) { $pass = $_REQUEST['old_password']; if (verifyLogin($user_id, $_REQUEST['old_password']) === true) { if (isset($_REQUEST['description']) && isset($_REQUEST['view_time']) && isset($_REQUEST['open_time']) && isset($_REQUEST['close_time'])) { $description = escape($_REQUEST['description']); $view_time = strtotime($_REQUEST['view_time']); $open_time = strtotime($_REQUEST['open_time']); $close_time = strtotime($_REQUEST['close_time']); $num_recommend = escape($_REQUEST['num_recommend']); mysql_query("UPDATE clubs SET description='{$description}', view_time='{$view_time}', open_time='{$open_time}', close_time='{$close_time}', num_recommend='{$num_recommend}' WHERE id='{$club_id}'"); $success = "Club information updated successfully."; } if (isset($_REQUEST['new_password']) && isset($_REQUEST['new_password_conf']) && isset($_REQUEST['email'])) { $update_res = updateAccount($user_id, $pass, $_REQUEST['new_password'], $_REQUEST['new_password_conf'], $_REQUEST['email']); if ($update_res == 0) { $success = "Club and account info updated successfully!"; } else { if (abs($update_res) == 1) { $error = "Invalid New Password!"; } else { if ($update_res == -2) { $error = "Internal Error while updating account!"; } else { if ($update_res == 10) { $error = "Invalid new email!"; } else { if ($update_res == 11) { $error = "Passwords do not match!"; }
<?php include 'includes/header.php'; require_once DIR_APP . 'projects.php'; require_once DIR_APP . 'users.php'; if (empty($_SESSION['logged_in'])) { redirect('index.php'); } if (isset($_POST['save_account'])) { updateAccount($_POST); } $user = getUserData($_SESSION['uid']); ?> <div class="inner-page-wrapper"> <div class="account inner-page content"> <?php include DIR_INCLUDE . 'left_nav.php'; ?> <div class="main-content"> <ul class="router-top-nav"> <li class="active"><a href="account.php">Account</a></li> <li><a href="privacy.php">Privacy</a></li> <li><a href="payment.php">Payment</a></li> <li><a href="report.php">Report</a></li> <li class="logout"><a href="logout.php">Logout</a></li>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . 'cloud/models/settings/update.php'; $inputArr = $_REQUEST; session_start(); extract($_REQUEST); //check for required variables if (!isset($action)) { $resp = array("status" => "fail", "reason" => "please send an action"); echo json_encode($resp); return; } switch ($action) { case "update": $email = $_REQUEST['email']; $inputArr['passwd'] = md5($inputArr['passwd']); $resp = updateAccount($inputArr); echo json_encode($resp); exit; break; case "loggedin": $resp = isUserLoggedIn(); echo json_encode($resp); exit; break; default: $resp = array("status" => "fail", "reason" => "please send a valid action other than " . $action); echo json_encode($resp); break; }
<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { require 'connection.php'; updateAccount(); } else { echo 'Error'; } function updateAccount() { global $connect; $data = json_decode(file_get_contents('php://input'), true); $response = array(); if (!$data) { $response['error']['message'] = "Invalid request."; } else { if (!isset($data['firstname']) || empty(trim($data['firstname']))) { $response['error']['message'] = "Firstname is required."; } else { if (!isset($data['lastname']) || empty(trim($data['lastname']))) { $response['error']['message'] = "Lastname is required."; } else { if (!isset($data['email']) || empty(trim($data['email']))) { $response['error']['message'] = "Email is required."; } else { if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { $response['error']['message'] = 'Invalid email format.'; } else { $firstname = ucwords(strtolower(trim($data['firstname']))); $lastname = ucwords(strtolower(trim($data['lastname']))); $email = trim($data['email']);
<?php include "../include/common.php"; include "../config.php"; include "../include/db_connect.php"; include "../include/session.php"; if (isset($_SESSION['user_id'])) { $profile = getProfile($_SESSION['user_id']); $userInfo = getUserInformation($_SESSION['user_id']); //array of (username, email, name) if (isset($_POST['old_password']) && isset($_POST['new_password']) && isset($_POST['new_password_conf']) && isset($_POST['new_email'])) { $result = updateAccount($_SESSION['user_id'], $_POST['old_password'], $_POST['new_password'], $_POST['new_password_conf'], $_POST['new_email']); if ($result === 0) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "Account updated successfully.")); } else { if ($result == -1) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "Invalid password for old password supplied. Information was not changed.")); } else { if ($result == -2) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "Action attempted too many times. Please try again later.")); } else { if ($result == 1) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "New password is too short (less than six characters).")); } else { if ($result == 10) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "New email address is invalid.")); } else { if ($result == 11) { get_page_advanced("account", "apply", array("profile" => $profile, "userInfo" => $userInfo, "message" => "New passwords do not match.")); } }
<?php $timeStart = microtime(true); session_start(); if (empty($_SESSION)) { exit(header("Location: ../../index.php")); } require_once $_SESSION['File_Root'] . '/Kernel/Include.php'; require_once $_SESSION['File_Root'] . '/HTML/Header.php'; require_once 'Functions/SQL.php'; redirectToLogin($accountID, $linkRoot); redirectToBattle($verifyBattle, $linkRoot); hasAdmin($accountAccess); $accountID = htmlspecialchars(addslashes($_POST['accountID'])); $accountPseudo = htmlspecialchars(addslashes($_POST['accountPseudo'])); $accountEmail = htmlspecialchars(addslashes($_POST['accountEmail'])); $accountAccess = htmlspecialchars(addslashes($_POST['accountAccess'])); updateAccount($bdd, $accountPseudo, $accountEmail, $accountAccess, $accountID); ?> <br> <form method="POST" action="index.php"> <input class="btn btn-success" type="submit" value="Ok"> </form> <br/> <?php require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
require_once dirname(dirname(dirname(__FILE__))) . '/core/system/ajax.php'; require_once dirname(dirname(dirname(__FILE__))) . "/common/php/class/class.user.php"; require_once dirname(dirname(dirname(__FILE__))) . "/common/php/class/class.user_newsletter.php"; if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; switch ($action) { case 'updateAccount': // Acquisition de toutes les variables isset($_POST['first-name']) && !empty($_POST['first-name']) ? $first_name = $_POST['first-name'] : ($first_name = null); isset($_POST['last-name']) && !empty($_POST['last-name']) ? $last_name = $_POST['last-name'] : ($last_name = null); isset($_POST['birthday']) && !empty($_POST['birthday']) ? $birthday = $_POST['birthday'] : ($birthday = null); isset($_POST['sex']) && !empty($_POST['sex']) ? $sex = $_POST['sex'] : ($sex = null); isset($_POST['email']) && !empty($_POST['email']) ? $email = $_POST['email'] : ($email = null); isset($_POST['password']) && !empty($_POST['password']) ? $password = $_POST['password'] : ($password = null); isset($_POST['newsletter']) && !empty($_POST['newsletter']) ? $newsletter = $_POST['newsletter'] : ($newsletter = null); echo updateAccount($first_name, $last_name, $birthday, $sex, $email, $password, $newsletter); break; } } function updateAccount($first_name, $last_name, $birthday, $sex, $email, $password, $newsletter) { global $bdd; global $_TABLES; global $config; if (isset($_SESSION['user_id'])) { // Création de l'objet User $objUser = new User($bdd, $_TABLES); // Sauvegarde temporaire des anciennes données utilisateurs $user = $objUser->getData($_SESSION['user_id']); // Mise en forme des données $birthday_temp = explode("/", $birthday);