<?php ##################################################################### # # File : CHANGE PROFILE # Project : Game Magazine Project # Author : Béo Sagittarius # Created : 07/01/2015 # ##################################################################### --> include 'includes/backend/mysqli_connect.php'; include 'includes/functions.php'; if (isset($_POST)) { $uid = $_SESSION['uid']; $first_name = mysqli_real_escape_string($dbc, $_POST['firstname']); $last_name = mysqli_real_escape_string($dbc, $_POST['lastname']); $website = mysqli_real_escape_string($dbc, $_POST['website']); $bio = mysqli_real_escape_string($dbc, $_POST['bio']); $datepost = $_POST['dateofbirth']; $date = DateTime::createFromFormat('d-m-Y', $datepost); $dateofbirth = $date->format('Y-m-d H:i:s'); $result = change_profile($uid, $first_name, $last_name, $website, $bio, $dateofbirth); if (mysqli_affected_rows($dbc) == 1) { echo json_encode(['status' => 'OK']); } else { echo json_encode(['status' => 'FAIL']); } }
function handleChangeProfile() { // are we in change profile mode? $showChangeProfile = $GLOBALS['ESPCONFIG']['dashboard_allow_change_profile'] && empty($_REQUEST['doChangeProfileCancel']) && is_session_authenticated() && isset($_REQUEST['doChangeProfile']) ? true : false; // are we also changing the password? $handleChangeProfile = $showChangeProfile && get_current_respondent($respondent) && isset($_REQUEST['firstName']) && isset($_REQUEST['lastName']) && isset($_REQUEST['emailAddress']) ? true : false; // if changing, handle it if ($handleChangeProfile) { $ok = change_profile($respondent['username'], $respondent['realm'], $_REQUEST['firstName'], $_REQUEST['lastName'], $_REQUEST['emailAddress']); if ($ok) { $showChangeProfile = false; } else { $GLOBALS['errmsg'] = mkerror(_('Unable to change your password; contact an administrator')); } } // if we're showing the change profile form, do so if ($showChangeProfile) { if (empty($_REQUEST['firstName'])) { $_REQUEST['firstName'] = $respondent['fname']; } if (empty($_REQUEST['lastName'])) { $_REQUEST['lastName'] = $respondent['lname']; } if (empty($_REQUEST['emailAddress'])) { $_REQUEST['emailAddress'] = $respondent['email']; } paint_header(); echo '<div class="dashboardPanel">' . '<h1>' . _('Change My Profile') . '</h1>' . render_profile_change_form() . '</div>'; paint_footer(); exit; } }