コード例 #1
0
ファイル: register.php プロジェクト: atelierBek/bekforum
        if ($image_sizes[0] > $maxwidth or $image_sizes[1] > $maxheight) {
            $i++;
            $avatar_erreur2 = "Image trop large ou trop longue :\n\t\t\t\t(<strong>" . $image_sizes[0] . "x" . $image_sizes[1] . "</strong> contre <strong>" . $maxwidth . "x" . $maxheight . "</strong>)";
        }
        $extension_upload = strtolower(substr(strrchr($_FILES['avatar']['name'], '.'), 1));
        if (!in_array($extension_upload, $extensions_valides)) {
            $i++;
            $avatar_erreur3 = "Extension de l'avatar incorrecte";
        }
    }
    if ($i == 0) {
        echo '<h1>Inscription terminée</h1>';
        echo '<p>Bienvenue ' . stripslashes(htmlspecialchars($_POST['pseudo'])) . ' vous êtes maintenant inscrit sur le forum</p>
			<p>Cliquez <a href="./index.php">ici</a> pour revenir à la page d accueil</p>';
        //La ligne suivante sera commentée plus bas
        $nomavatar = !empty($_FILES['avatar']['size']) ? move_avatar($_FILES['avatar']) : '';
        $query = $db->prepare('INSERT INTO forum_membres (membre_pseudo, membre_mdp, membre_email,
				membre_msn, membre_siteweb, membre_avatar,
				membre_signature, membre_localisation, membre_inscrit,
				membre_derniere_visite)
				VALUES (:pseudo, :pass, :email, :msn, :website, :nomavatar, :signature, :localisation, :temps, :temps)');
        $query->bindValue(':pseudo', $pseudo, PDO::PARAM_STR);
        $query->bindValue(':pass', $pass, PDO::PARAM_INT);
        $query->bindValue(':email', $email, PDO::PARAM_STR);
        $query->bindValue(':msn', $msn, PDO::PARAM_STR);
        $query->bindValue(':website', $website, PDO::PARAM_STR);
        $query->bindValue(':nomavatar', $nomavatar, PDO::PARAM_STR);
        $query->bindValue(':signature', $signature, PDO::PARAM_STR);
        $query->bindValue(':localisation', $localisation, PDO::PARAM_STR);
        $query->bindValue(':temps', $temps, PDO::PARAM_INT);
        $query->execute();
コード例 #2
0
ファイル: voirprofil.php プロジェクト: atelierBek/bekforum
                $image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
                if ($image_sizes[0] > $maxwidth or $image_sizes[1] > $maxheight) {
                    $i++;
                    $avatar_erreur2 = "Image trop large ou trop longue :\n        (<strong>" . $image_sizes[0] . "x" . $image_sizes[1] . "</strong> contre\n        <strong>" . $maxwidth . "x" . $maxheight . "</strong>)";
                }
                $extension_upload = strtolower(substr(strrchr($_FILES['avatar']['name'], '.'), 1));
                if (!in_array($extension_upload, $extensions_valides)) {
                    $i++;
                    $avatar_erreur3 = "Extension de l'avatar incorrecte";
                }
            }
            echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Modification du profil';
            echo '<h1>Modification d\'un profil</h1>';
            if ($i == 0) {
                if (!empty($_FILES['avatar']['size'])) {
                    $nomavatar = move_avatar($_FILES['avatar']);
                    $query = $db->prepare('UPDATE forum_membres
                SET membre_avatar = :avatar
                WHERE membre_id = :id');
                    $query->bindValue(':avatar', $nomavatar, PDO::PARAM_STR);
                    $query->bindValue(':id', $id, PDO::PARAM_INT);
                    $query->execute();
                    $query->CloseCursor();
                }
                //Une nouveauté ici : on peut choisis de supprimer l'avatar
                if (isset($_POST['delete'])) {
                    $query = $db->prepare('UPDATE forum_membres
		SET membre_avatar=0 WHERE membre_id = :id');
                    $query->bindValue(':id', $id, PDO::PARAM_INT);
                    $query->execute();
                    $query->CloseCursor();