Пример #1
0
    $proyecto_nombre = $wpdb->get_var("SELECT name FROM wp_terms WHERE term_id = '{$proyecto}'");
    function generatePassword($length = 9)
    {
        $consonants = 'BDGHJLMNPQRSTVWXZ';
        $numbers .= '123456789';
        $password = '';
        for ($i = 0; $i < 3; $i++) {
            $password .= $consonants[rand() % strlen($consonants)];
        }
        $password .= '-';
        for ($i = 3; $i < $length; $i++) {
            $password .= $numbers[rand() % strlen($numbers)];
        }
        return $password;
    }
    $assigned = generatepassword(7);
    $title = '#' . $assigned . ' ' . $post_title . ' (' . $proyecto_nombre . ')';
    // if no category was selected, unset it & default will be used
    /*       if ($post_category == '-1') {
                unset($post_category);
            } elseif ( isset($post_category) ) {
               $post_category = array($post_category);
            }
    */
    $post_id = wp_insert_post(array('post_author' => $user_id, 'post_title' => $title, 'post_content' => $post_content, 'post_category' => $post_category, 'post_name' => $assigned, 'tags_input' => $tags, 'post_status' => 'publish'));
    wp_notify_mail($title, $post_content, $post_category, $assigned);
    wp_redirect(get_bloginfo('url') . '/');
    exit;
}
get_header();
$ifdone = $_COOKIE['muestradone'];
        $consonants = 'bdghjmnpqrstvz23456789';
        $password = '';
        $alt = time() % 2;
        for ($i = 0; $i < 9; $i++) {
            if ($alt == 1) {
                $password .= $consonants[rand() % strlen($consonants)];
                $alt = 0;
            } else {
                $password .= $vowels[rand() % strlen($vowels)];
                $alt = 1;
            }
        }
        return $password;
    }
    if ($xmlp->robindash->notifymail == $_GET['email']) {
        $password = generatepassword();
        mail($xmlp->robindash->notifymail, "Your " . $brand . " accounts password has been reset", "Hi there " . $_GET['user'] . ",\n\nThis is an email to let you know that your accounts password at " . $brand . " has been reset.\nYour new password will be: " . $password . "\n\nPlease login to your account at: http://" . $sn . $wdir . " to change it to something more memorable soon.\n\nRegards,\nThe " . $brand . " Team");
        $fc = file_get_contents($dir . "data/" . $_GET['user'] . ".xml");
        $fc = str_replace($xmlp->robindash->password, md5($password), $fc);
        $fh = fopen($dir . "data/" . $_GET['user'] . ".xml", 'w') or die("Can't write to the data file.");
        fwrite($fh, $fc);
        fclose($fh);
        header("Location: " . $wdir . "reset-password.php?status=reset&is_modal=" . $_GET['is_modal']);
        exit;
    } else {
        header("Location: " . $wdir . "reset-password.php?status=wrong-email&is_modal=" . $_GET['is_modal']);
        exit;
    }
} else {
    if (isset($_GET['user']) && isset($_GET['email'])) {
        header("Location: " . $wdir . "reset-password.php?status=wrong-user&is_modal=" . $_GET['is_modal']);
    <head>
        <meta charset="utf-8">
        <title>Formulaire</title>
		<link rel="stylesheet" type="text/css" href="style.css">
	</head>
    <body>
		<header>
		<a href="pageAccueil.php" style="text-decoration:none"><h1>EmuRétroWorld</h1></a>
		</header>
		<?php 
if (isset($_POST['Nom']) && isset($_POST['Prenom']) && isset($_POST['Bdate']) && isset($_POST['Mail']) && isset($_POST['Pseudo']) && isset($_POST['Sex']) && $_POST['Prenom'] != '' && $_POST['Nom'] != '' && $_POST['Bdate'] != '' && $_POST['Mail'] != '@' && $_POST['Bdate'] != 'jj/mm/aaaa' && $_POST['Pseudo'] != '') {
    $u = htmlspecialchars($_POST['Pseudo'], ENT_QUOTES);
    $cursor = $collection->find(array('username' => $u));
    if (!$cursor->hasNext()) {
        require_once 'generatepassword.php';
        $mdpass = generatepassword();
        //haché de la base de données(on la stock dans la base de données pour plus de sécurité):créer une chaîne de caractère à partir de laquelle il es très dur de retrouver le mdp,
        $hmdp = SHA1($mdpass);
        //Stockage des données
        $c = htmlspecialchars($_POST['Nom'], ENT_QUOTES);
        $d = htmlspecialchars($_POST['Prenom'], ENT_QUOTES);
        $e = htmlspecialchars($_POST['Sex'], ENT_QUOTES);
        $f = htmlspecialchars($_POST['Bdate'], ENT_QUOTES);
        $g = htmlspecialchars($_POST['Mail'], ENT_QUOTES);
        $h = htmlspecialchars($_POST['Pseudo'], ENT_QUOTES);
        $i = htmlspecialchars($hmdp);
        $collection->save(array('nom' => $c, 'prenom' => $d, 'sex' => $e, 'bdate' => $f, 'mail' => $g, 'username' => $h, 'hachepassword' => $i));
        //Affichage du message
        echo "<section id='secmdp'>";
        echo "<p id='p' class='b'>Bravo. Vous êtes inscrit correctement</p>";
        echo "<p class='b'>Voici votre mot de passe </p> ";