예제 #1
0
        } else {
            $size = getimagesize($tmp_file);
            if ($size['0'] > $lmax || $size['1'] > $hmax) {
                $s = 1;
                $avatar = $avatarr;
            } else {
                $avatar = 'avatarup/' . $nom;
                if (strstr($avatarr, 'avatarup/avatar')) {
                    @unlink("{$avatarr}");
                }
                @unlink("{$avatarr}");
                move_uploaded_file($tmp_file, 'avatarup/' . $nom);
            }
        }
    } else {
        echo 'nok' . GetExtensionName($file_name);
    }
    @unlink($tmp_file);
} elseif ($avatar != "") {
    if (ereg(".jpg\$", $avatar) && ereg("^http://", $avatar) || ereg(".jpeg\$", $avatar) && ereg("^http://", $avatar) || ereg(".gif\$", $avatar) && ereg("^http://", $avatar)) {
        $size = getimagesize($avatar);
        if ($size['0'] < $lmax && $size['1'] < $hmax) {
            // && filesize($avatar) < $pmax
            $sqli = intval($_SESSION['idlog']);
            if ($rang == 2 && isset($_GET['id'])) {
                $sqli = intval($_GET['id']);
            }
            copy($avatar, 'avatarup/avatar' . $sqli . 'tmp');
            if (filesize('avatarup/avatar' . $sqli . 'tmp') > $pmax) {
                $p = 1;
                unlink('avatarup/avatar' . $sqli . 'tmp');
예제 #2
0
 $result = $db->query($sql) or error('Ne peut trouver les utilisateurs dans la base de données', __FILE__, __LINE__, $db->error());
 while ($row = $db->fetch_assoc($result)) {
     $addresses[$row['username']] = $row['email'];
 }
 $usercount = count($addresses);
 if (!empty($_POST['message_file'])) {
     $mail_file = $_POST['message_file'];
     if (GetExtensionName($mail_file) == 'jpg') {
         $type_file = 'image/jpeg';
     } elseif (GetExtensionName($mail_file) == 'gif') {
         $type_file = 'image/gif';
     } elseif (GetExtensionName($mail_file) == 'png') {
         $type_file = 'image/png';
     } elseif (GetExtensionName($mail_file) == 'pdf') {
         $type_file = 'application/pdf';
     } elseif (GetExtensionName($mail_file) == 'zip') {
         $type_file = 'application/zip';
     } else {
         $type_file = 'text/plain';
     }
     $piecejointe = true;
 }
 if ($_POST['type_mail'] == 'html') {
     $type_mail = 'text/html';
     $mail_subject = pun_htmlspecialchars($_POST['message_subject']);
     $mail_message = $_POST['message_body'];
 } else {
     $type_mail = 'text/plain';
     $mail_subject = pun_htmlspecialchars($_POST['message_subject']);
     $mail_message = pun_htmlspecialchars(format_text($_POST['message_body']));
     //pun_htmlspecialchars($_POST['message_body']));