$req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET email = :email WHERE id = ' . $_SESSION['id']);
             $req->execute(array('email' => $minEmail));
             LOF_successPopup("Modification effectuée (Mail), rechargement de la page dans quelques secondes ...");
         } else {
             LOF_errorPopup("Le nom de compte ou l\\'adresse email sont invalide.");
         }
     } else {
         LOF_errorPopup("Nom de compte ou adresse mail invalide.");
     }
 }
 //Update Password
 if (!empty($_POST['actualPassword']) and !empty($_POST['newPassword']) and !empty($_POST['newPasswordAgain'])) {
     $actualPassword = LOF_encrypt($_POST['actualPassword']);
     if ($data['password'] == $actualPassword) {
         $newPassword = LOF_encrypt($_POST['newPassword']);
         $newPasswordAgain = LOF_encrypt($_POST['newPasswordAgain']);
         if ($newPassword == $newPasswordAgain) {
             $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET password = :password WHERE id = ' . $_SESSION['id']);
             $req->execute(array('password' => $newPassword));
             LOF_successPopup("Modification effectuée (Mot de passe), rechargement de la page dans quelques secondes ...");
         } else {
             LOF_errorPopup("Le nouveau mot de passe n'est pas identiques dans les 2 champs.");
         }
     } else {
         LOF_errorPopup("Le mot de passe actuel n'est pas valide.");
     }
 }
 //Update About
 if ($_POST['signature'] != $data['signature'] or $_POST['skype'] != $data['skype'] or $_POST['twitter'] != $data['twitter'] or $_POST['facebook'] != $data['facebook'] or $_POST['youtube'] != $data['youtube'] or $_POST['website1'] != $data['website1'] or $_POST['website2'] != $data['website2'] or $_POST['website3'] != $data['website3']) {
     $req = $bdd->prepare('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET signature = :signature, skype = :skype, twitter = :twitter, facebook = :facebook, youtube = :youtube, website1 = :website1, website2 = :website2, website3 = :website3 WHERE id = ' . $_SESSION['id']);
     $req->execute(array('signature' => $_POST['signature'], 'skype' => $_POST['skype'], 'twitter' => $_POST['twitter'], 'facebook' => $_POST['facebook'], 'youtube' => $_POST['youtube'], 'website1' => $_POST['website1'], 'website2' => $_POST['website2'], 'website3' => $_POST['website3']));
Example #2
0
if (!empty($_POST)) {
    try {
        //Verify Value
        if (!isset($_POST['loginName']) and !isset($_POST['loginPassword'])) {
            throw new Exception('Certains champs ne sont pas remplit.');
        }
        //Get Value
        $loginName = $_POST['loginName'];
        $loginPassword = $_POST['loginPassword'];
        $date = new Datetime('now', new DateTimeZone('Europe/Paris'));
        //Verify value not empty
        if (empty($loginName) and empty($loginPassword)) {
            throw new Exception('Certains champs ne sont pas remplit.');
        }
        //Crypt password
        $loginPassword = LOF_encrypt($loginPassword);
        //BDD connection
        $bdd = LOFConnect();
        //Account exist ?
        $reply = $bdd->query("SELECT " . $GLOBALS['LOF_BDD_TABLE_account'] . ".id, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".rank, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".pseudo, " . $GLOBALS['LOF_BDD_TABLE_account'] . ".password FROM " . $GLOBALS['LOF_BDD_TABLE_account'] . " WHERE pseudo='" . $loginName . "'");
        //Modifier la requête
        $value = $reply->fetch();
        if (!($value['pseudo'] == $loginName and $value['password'] == $loginPassword)) {
            throw new Exception('Mot de passe ou nom de compte incorrect.');
        }
        //GOOD
        $req = $bdd->query('UPDATE ' . $GLOBALS['LOF_BDD_TABLE_account'] . ' SET lastlogin = NOW() WHERE id = ' . $value['id']);
        $_SESSION['id'] = $value['id'];
        $_SESSION['rank'] = $value['rank'];
        $_SESSION['user'] = $value['pseudo'];
        $_SESSION['connect'] = 1;
Example #3
0
 $minEmail = strtolower($registrationEmail);
 $registrationPassword = $_POST['registrationPassword'];
 $registrationPassword_again = $_POST['registrationPassword_again'];
 $date = new Datetime('now', new DateTimeZone('Europe/Paris'));
 //Verify value not empty
 if (!(isset($_POST['charteAccepted']) and !empty($registrationName) and preg_match('/^[a-zA-Z0-9]+$/', $registrationName) and !empty($registrationEmail) and filter_var($registrationEmail, FILTER_VALIDATE_EMAIL) and !empty($registrationPassword) and !empty($registrationPassword_again))) {
     //Password
     throw new Exception('Certains champs ne sont pas remplit correctement.');
 }
 //Verify Pseudo
 if (!(strlen($registrationName) >= 2 and strlen($registrationName) <= 20)) {
     throw new Exception('Le nom de compte ne respecte pas le formatage accepté. (2 à 20 caractères)');
 }
 //Crypt password
 $registrationPassword = LOF_encrypt($registrationPassword);
 $registrationPassword_again = LOF_encrypt($registrationPassword_again);
 //BDD connection
 $bdd = LOFConnect();
 //Account exist ?
 $reply = $bdd->query("SELECT " . $GLOBALS['LOF_BDD_TABLE_account'] . ".pseudo FROM " . $GLOBALS['LOF_BDD_TABLE_account'] . " WHERE pseudo='" . $registrationName . "' OR email='" . $minEmail . "'");
 $value = $reply->fetch();
 if (!($value == null)) {
     throw new Exception('Le nom de compte ou l\'adresse email sont invalide.');
 }
 //Password
 if (!($registrationPassword == $registrationPassword_again)) {
     throw new Exception('Les mots de passe ne sont pas identiques.');
 }
 $req = $bdd->prepare('INSERT INTO ' . $GLOBALS['LOF_BDD_TABLE_account'] . '(rank, pseudo, password, email, created, lastlogin) VALUES(:rank,:pseudo,:password,:email,:created,:lastlogin)');
 $req->execute(array('rank' => 0, 'pseudo' => $registrationName, 'password' => $registrationPassword, 'email' => $minEmail, 'created' => $date->format('Y-m-d'), 'lastlogin' => $date->format('Y-m-d')));
 //Generate Avatar