Example #1
0
        // Try to create the config file
        echo '<h3>Configuration file creation</h3>';
        $configContent = '
[BDD]
BDD_TYPE="' . strtoupper($db_type) . '"
BDD_HOTE="' . $db_host . '"
BDD_PORT="' . $db_port . '"
BDD_BASENAME="' . $db_name . '"
BDD_LOGIN="******"
BDD_PASSWORD="******"
BDD_PREFIX="' . $db_prefix . '"

BDD_CRYPT_PASS="******"

[PASSWORD]
PASSWORD_SALT="' . stringGenerate(8) . '"
HASH_METHOD="sha512"
    	';
        file_put_contents('conf/config.ini', $configContent);
        if (is_file('conf/config.ini')) {
            echo 'Configuration file created!<BR>';
        } else {
            echo 'Error in creating the configuration file. Check if "conf" folder exist and you are allowed to write in.<BR>';
            exit;
        }
        echo '<BR><BR><a href="setup.php?s=20"><span class="icon iconfa-download"> Create database structure</a>';
        break;
        // Default case
    // Default case
    default:
        echo '
Example #2
0
 function updatePassword($password, $isSendMail = 'TRUE')
 {
     $authMethodM = new authMethodManager();
     // Generate a password
     $generatedPassword = stringGenerate();
     if ($isSendMail == 'TRUE') {
         // On envoie le mail de confirmation avec le mot de passe
         $sujet = 'Modification du mot de passe - ' . get_ini('APPLICATION_NAME');
         $message = '
     	            Bonjour,<br />
     	            <br />
     	            Une réinitialisation de votre mot de passe a été demandée depuis l\'application ' . get_ini('APPLICATION_NAME') . '<br />
     	            Login: <strong>' . $this->mail . '</strong><br />
     	            Password: <strong>' . $generatedPassword . '</strong><br />
     	            <br />
     	            Merci!<br />
     	            <br />
     	            ' . get_ini('ADMIN_MAIL') . '
     	            ';
         $destinataire = $this->mail;
         $headers = "From: " . get_ini('ADMIN_MAIL') . "\n";
         $headers .= "Reply-To: " . get_ini('ADMIN_MAIL') . "\n";
         $headers .= "Content-Type: text/html; charset=\"UTF-8\"";
         if (mail($destinataire, $sujet, $message, $headers)) {
             echo "L'email a bien été envoyé. Votre mot de passe s'y trouve.";
         } else {
             echo "Une erreur c'est produite lors de l'envois de l'email.";
         }
     }
     $q0 = get_link()->prepare('UPDATE ' . get_ini('BDD_PREFIX') . 'core_user_auths SET password=:password,edited_id=:edited_id, edited_date=:edited_date WHERE user_id=:id AND auth_id=:auth_id');
     $q0->execute(array('id' => $this->id, 'password' => hashWithSalt($generatedPassword), 'auth_id' => $authMethodM->getId('LOCAL'), 'edited_id' => $_SESSION['USER_ID'], 'edited_date' => time()));
 }