<div class='editItemName' data-group=''>
            <span class="editItemTempClose"><i class="fa fa-times-circle-o"></i></span>
            <input class='itemName' name='itemName' placeholder='Name' value='' type='text' />
            <span class='btnSaveLinkEditName' title='Save name'><i class='fa fa-floppy-o'></i></span>
        </div>
        <div class="showMsg"></div>
        <div class="boxSing boxProfile" data-userid="<?php 
        echo $userKey;
        ?>
" style="border-bottom: none;">
            <div class="boxImgName">
                <?php 
        //                    echo "<pre>";
        //                    var_dump($usersInfo);
        //                    echo "</pre>";
        checkAvatar($url, $usersInfo, "Body");
        ?>
                <form enctype="multipart/form-data" method="post" action="" class="boxAvatarUpload">
                    <span class="boxAvatarUploadClose"><i class='fa fa-times'></i></span>
                    <input type="hidden" name="upload" value="1">
                    <input type="file" name="photo"  accept="image/png,image/jpeg,image/gif">
                    <input type="submit" value="Загрузить">
                </form>
                <h2 class="profileUsrName"><?php 
        echo $userName;
        ?>
</h2>
            </div>
            <div class="clear"></div>
            <span class="profileSaveEmailBtn"><i class="fa fa-check"></i></span><input type="email" required placeholder="Write your e-mail" value="<?php 
        echo $usersInfo[0]['email'];
Beispiel #2
0
" ><i class='fa fa-home'></i> Home</a></li>
                <li class="linkMenu"><a href="<?php 
echo base_url();
?>
main/archive" ><i class='fa fa-suitcase'></i> Archive</a></li>
            </ul>
            <p class="usrBar">
                <!--                <span class="usrBarConfiguration"><i class="fa fa-linux fa-lg"></i><i class="fa fa-firefox fa-lg"></i></span>-->
                <?php 
echo checkStatusAgent($statusAgent);
?>
                <span class="usrBarTxt">User: [ <strong class="usrBarTxtName"><?php 
echo $_SESSION['user_name'];
?>
</strong> ]</span>
                <br />
                <a href="<?php 
echo base_url();
?>
profile" class="usrBarProfile">Profile</a>
                <a href="<?php 
echo base_url();
?>
start/logout" class="usrBarExit">Logout</a>
                <?php 
echo checkAvatar($url, $usersInfo, "Header");
?>
            </p>
        </div>
        <div class="clear"></div>
Beispiel #3
0
    header('Location : index.php');
}
$user = $Model->recupUser($_SESSION['iduser']);
function checkAvatar()
{
    if (!isset($_POST['image']) || !preg_match('/^http[s]?:\\/\\/[-a-zA-Z0-9_.]*\\/[-a-zA-Z0-9\\/_.]*\\.(jp[e]?g|png|gif)$/', $_POST['image'])) {
        return "Url invalide";
    }
    $img = get_headers($_POST['image'], 1);
    if ($img['Content-Length'] > 256000) {
        return "Image trop lourde...200ko max";
    }
    return "NoError";
}
if (isset($_POST['change'])) {
    $error = checkAvatar();
    if ($error == "NoError") {
        $_SESSION['avatar'] = $_POST['image'];
        changeUrl($_SESSION['iduser'], $_POST['image']);
        header("Location : index.php?page=profil");
    } else {
        echo $error;
    }
}
function checkDataUser($Model, $user)
{
    if (!isset($_POST['pseudo']) || !preg_match('/^[a-zA-Z0-9-_ ]{4,25}$/', $_POST['pseudo'])) {
        return "Pseudo invalide, il ne doit être composé que de lettres.";
    }
    if ($Model->isPseudoInDb($_POST['pseudo']) && $user->pseudo != $_POST['pseudo']) {
        return "Pseudo déjà utilisé, merci d'en choisir un autre.";
Beispiel #4
0
 public static function updateTribeData($tribeID, $data)
 {
     global $db;
     if (empty($tribeID) || empty($data)) {
         return -30;
     }
     if (!self::validatePassword($data['password'])) {
         return -12;
     }
     // check if avatar is a image
     if (!empty($data['avatar'])) {
         $avatarInfo = checkAvatar($data['avatar']);
         if (!$avatarInfo) {
             return -13;
         } else {
             $data['avatar'] = $avatarInfo;
         }
     }
     $sql = $db->prepare("UPDATE " . TRIBE_TABLE . "\n                          SET name = :name,\n                            password = :password,\n                            description = :description,\n                            avatar = :avatar\n                          WHERE tribeID = :tribeID");
     $sql->bindValue('name', $data['name'], PDO::PARAM_STR);
     $sql->bindValue('password', $data['password'], PDO::PARAM_STR);
     $sql->bindParam('description', $data['description']);
     $sql->bindValue('avatar', $data['avatar'], PDO::PARAM_STR);
     $sql->bindValue('tribeID', $tribeID, PDO::PARAM_INT);
     if (!$sql->execute() || $sql->rowCount() == 0) {
         return 6;
     }
     return 5;
 }
Beispiel #5
0
/** This function sets the changed data specified by the user.
 */
function profile_update($db_login)
{
    global $db;
    $playerID = $_SESSION['player']->playerID;
    $data = array('avatar' => Request::getVar('inputPlayerAvatar', ''), 'description' => Request::getVar('inputPlayerDescription', '', true), 'email2' => Request::getVar('inputPlayerEmail2', ''), 'gfxpath' => Request::getVar('inputPlayerGFX', ''), 'icq' => Request::getVar('inputPlayerICQ', ''), 'language' => Request::getVar('inputPlayerLang', ''), 'origin' => Request::getVar('inputPlayerOrigin', ''), 'template' => Request::getVar('inputPlayerTemplate', ''), 'passwordNew' => Request::getVar('inputPlayerPasswordNew', ''), 'passwordRe' => Request::getVar('inputPlayerPasswordRe', ''), 'jabberPwdNew' => Request::getVar('inputJabberPasswordNew', ''), 'jabberPwdRe' => Request::getVar('inputJabberPasswordRe', ''));
    // validate language code
    $uaLanguageNames = LanguageNames::getLanguageNames();
    if (!isset($uaLanguageNames[$data['language']])) {
        unset($data['language']);
    }
    // check if avatar is a image
    if (isset($data['avatar']) && !empty($data['avatar'])) {
        $avatarInfo = checkAvatar($data['avatar']);
        if (!$avatarInfo) {
            return array('type' => 'error', 'message' => 'Ungültiges Bild oder URL beim Avatar! Wird zurückgesetzt!');
        } else {
            $data['avatar'] = $avatarInfo;
        }
    } else {
        $data['avatar'] = '';
    }
    if (filter_var($data['email2'], FILTER_VALIDATE_EMAIL) === false) {
        return array('type' => 'error', 'message' => 'Ungültiges E-Mail Adresse. Bitte nimm deine Eingaben erneut vor!');
    }
    if (strcmp($data['jabberPwdNew'], $data['jabberPwdRe']) != 0) {
        return array('type' => 'error', 'message' => _('Das Jabber Passwort stimmt nicht mit der Wiederholung überein.'));
    }
    // password too short?
    if (empty($data['jabberPwdNew'])) {
        $data['jabberPwdNew'] = null;
    } else {
        if (!preg_match('/^\\w{6,}$/', unhtmlentities($data['jabberPwdNew']))) {
            return array('type' => 'error', 'message' => _('Das Jabber Passwort muss mindestens 6 Zeichen lang sein!'));
        }
    }
    $sql = $db->prepare("UPDATE " . PLAYER_TABLE . "\n                       SET origin = :origin,\n                         icq = :icq,\n                         avatar = :avatar,\n                         description = :description,\n                         template = :template,\n                         language = :language,\n                         gfxpath = :gfxpath,\n                         email2 = :email2,\n                         avatar = :avatar,\n                         jabberPassword = :jabberPassword\n                       WHERE playerID = :playerID");
    $sql->bindValue('origin', $data['origin'], PDO::PARAM_STR);
    $sql->bindValue('icq', $data['icq'], PDO::PARAM_INT);
    $sql->bindValue('description', $data['description'], PDO::PARAM_STR);
    $sql->bindValue('template', $data['template'], PDO::PARAM_INT);
    $sql->bindValue('language', $data['language'], PDO::PARAM_STR);
    $sql->bindValue('gfxpath', $data['gfxpath'], PDO::PARAM_STR);
    $sql->bindValue('email2', $data['email2'], PDO::PARAM_STR);
    $sql->bindValue('avatar', $data['avatar'], PDO::PARAM_STR);
    $sql->bindValue('jabberPassword', $data['jabberPwdNew'], PDO::PARAM_STR);
    $sql->bindValue('playerID', $playerID, PDO::PARAM_INT);
    if (!$sql->execute()) {
        return array('type' => 'error', 'message' => _('Die Daten konnten gar nicht oder zumindest nicht vollständig aktualisiert werden.'));
    }
    // ***** now update the password, if it is set **** **************************
    if (strlen($data['passwordNew'])) {
        // typo?
        if (strcmp($data['passwordNew'], $data['passwordRe']) != 0) {
            return array('type' => 'error', 'message' => _('Das Spiel Passwort stimmt nicht mit der Wiederholung überein.'));
        }
        // password too short?
        if (!preg_match('/^\\w{6,}$/', unhtmlentities($data['passwordNew']))) {
            return array('type' => 'error', 'message' => _('Das Spiel Passwort muss mindestens 6 Zeichen lang sein!'));
        }
        // set password
        $sql = $db_login->prepare("UPDATE Login SET password = :password WHERE LoginID = :loginID");
        $sql->bindValue('password', $data['passwordNew'], PDO::PARAM_STR);
        $sql->bindValue('loginID', $playerID, PDO::PARAM_INT);
        if (!$sql->execute() || $sql->rowCount() == 0) {
            return array('type' => 'error', 'message' => _('Die Daten konnten gar nicht oder zumindest nicht vollständig aktualisiert werden.'));
        }
    }
    return array('type' => 'success', 'message' => _('Die Daten wurden erfolgreich aktualisiert.'));
}
Beispiel #6
0
function tribe_processAdminUpdate($tag, $data)
{
    global $db;
    $auth = new auth();
    if (!tribe_validatePassword($data['password'])) {
        return -12;
    }
    // check if avatar is a image
    if (!empty($data['avatar'])) {
        $avatarInfo = checkAvatar($data['avatar']);
        if (!$avatarInfo) {
            return -13;
        } else {
            $data['avatar'] = $avatarInfo;
        }
    }
    $sql = $db->prepare("UPDATE " . TRIBE_TABLE . "\n                        SET name = :name,\n                          password = :password,\n                          description = :description,\n                          avatar = :avatar\n                        WHERE tag = :tag");
    $sql->bindValue('name', $data['name'], PDO::PARAM_STR);
    $sql->bindValue('password', $data['password'], PDO::PARAM_STR);
    $sql->bindParam('description', $data['description']);
    $sql->bindValue('avatar', $data['avatar'], PDO::PARAM_STR);
    $sql->bindValue('tag', $tag, PDO::PARAM_STR);
    if (!$sql->execute() || $sql->rowCount() == 0) {
        return 6;
    }
    return 5;
}