Example #1
0
function courierimage($char, $width = 8, $height = 12, $pdir = 'patterns/')
{
    $im = imagecreate($width, $height);
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 0, 0, 0);
    imagettftext($im, 10, 0, 0, 10, $text_color, 'cour.ttf', $char);
    $imgarray_0 = img2array($im, $width, $height);
    $imgarray_1 = img_array_split($imgarray_0);
    $imgarray_2 = img_array_split($imgarray_1);
    $ia2name = img_array_name($imgarray_2);
    if (!file_exists($pdir . $ia2name)) {
        mkdir($pdir . $ia2name);
    }
    $ia1name = img_array_name($imgarray_1);
    if (!file_exists($pdir . $ia2name . '/' . $ia1name)) {
        mkdir($pdir . $ia2name . '/' . $ia1name);
    }
    $ia0name = img_array_name($imgarray_0);
    $filename = $pdir . $ia2name . '/' . $ia1name . '/' . $ia0name . '.txt';
    if (!file_exists($filename)) {
        // $handle = fopen($filename,'w');
        writeUTF8File($filename, $char);
    }
    $filename = $pdir . $ia2name . '/' . $ia1name . '/' . $ia0name . '.gif';
    if (!file_exists($filename)) {
        ImageGif($im, $filename);
        chmod($filename, 0777);
    }
    echo '<table><tr><td>' . print_img_array($imgarray_0) . '</td><td>' . print_img_array($imgarray_1) . '</td><td>' . print_img_array($imgarray_2) . "</td><td><img src=\"{$filename}\" /></td></table>";
}
function courierimage($char, $width = 8, $height = 12, $pdir = 'patterns/')
{
    $im = imagecreate($width, $height);
    $background_color = imagecolorallocate($im, 255, 255, 255);
    $text_color = imagecolorallocate($im, 0, 0, 0);
    $imchar = $char;
    $imchar = mb_encode_numericentity($imchar, array(0x0, 0xffff, 0, 0xffff), 'UTF-8');
    // echo $imchar;
    imagettftext($im, 10, 0, 0, 10, $text_color, 'cour.ttf', $imchar);
    $imgarray_0 = img2array($im, $width, $height);
    $imgarray_1 = img_array_split($imgarray_0);
    $imgarray_2 = img_array_split($imgarray_1);
    $ia2name = img_array_name($imgarray_2);
    if (!file_exists($pdir . $ia2name)) {
        mkdir($pdir . $ia2name);
    }
    $ia1name = img_array_name($imgarray_1);
    if (!file_exists($pdir . $ia2name . '/' . $ia1name)) {
        mkdir($pdir . $ia2name . '/' . $ia1name);
    }
    $ia0name = img_array_name($imgarray_0);
    $filename = $pdir . $ia2name . '/' . $ia1name . '/' . $ia0name . '.txt';
    if (!file_exists($filename)) {
        writeUTF8File($filename, $char);
    }
    $filename = $pdir . $ia2name . '/' . $ia1name . '/' . $ia0name . '.gif';
    if (!file_exists($filename)) {
        ImageGif($im, $filename);
        chmod($filename, 0777);
    }
    // echo '<table><tr><td>'.print_img_array($imgarray_0).'</td><td>'.print_img_array($imgarray_1).'</td><td>'.print_img_array($imgarray_2)."</td><td><img src=\"$filename\" /></td></table>";
}
//ini_set('display_errors',1);
//error_reporting(E_ALL);
date_default_timezone_set('Europe/Amsterdam');
$t = date('m/d/Y h:i:s a', time());
$t0 = "Data Received: ";
$from = $_POST['from'];
$to = $_POST['to'];
$plain_text = $_POST['plain'];
//header("Content-type: text/plain");
//header("HTTP/1.0 200 OK");
$b = '<center><textarea name="myTextBox" cols="100" rows="30" style="border:3px dashed #F7730E;">';
$eb = "</textarea></center>";
$n = "</br>";
$k = "=============================================</br>";
$fromm = "From: ";
$rtl1 = '<div dir="rtl">';
$rtl2 = "</div>";
$too = "To: ";
//It is a mess here I know, but I like messy stuff!
$content1 = $k . $n . $k . $n . $t0 . $t . $n . $fromm . $from . $n . $too . $to . $n . $rtl1 . $b . $plain_text . $eb . $rtl2 . $n . $n . $n;
function writeUTF8File($filename, $content)
{
    $f = fopen($filename, "a");
    # Now UTF-8 - Add byte order mark
    fwrite($f, pack("CCC", 0xef, 0xbb, 0xbf));
    fwrite($f, $content);
    fclose($f);
}
writeUTF8File("index.php", $content1);
exit;
// Open file with last order id
$versionFile = fopen("orders/id", "r+") or die("Unable to open file!");
$orderId = intval(fread($versionFile, filesize("orders/id")));
rewind($versionFile);
fwrite($versionFile, $orderId + 1);
fclose($versionFile);
// Prepare email information
$from = $_GET["from"];
$cc = "*****@*****.**";
$to = "*****@*****.**";
$subject = "Froggy Order #" . $orderId;
$message = $_GET["data"];
// Update order number in message
$message = str_replace("{orderId}", $orderId, $message);
// Save file to disk
writeUTF8File("orders/order" . $orderId . ".html", $message);
// Send information about order to manager
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: ' . $from . "\r\n";
$headers .= 'Cc: ' . $cc . "\r\n";
mail($to, $subject, $message, $headers);
// Send cover letter to customer
echo "<orderId>" . $orderId . "</orderId>";
// Write UTF8 File
function writeUTF8File($filename, $content)
{
    $f = fopen($filename, "w") or die("Unable to open file!");
    # Now UTF-8 - Add byte order mark
Example #5
0
    $gagnant15_5 = stripslashes($_POST["gagnant15_5"]);
}
function getLigne($rapport, $gagnant, $prono, $type)
{
    if ($prono == "") {
        return "";
    }
    return "<tr class=\"enreg {$type}\"><td class=\"eqg\">{$prono}</td><td class=\"eqd\">{$gagnant}</td><td class=\"eqd\">{$rapport}</td></tr>";
}
function writeUTF8File($filename, $content)
{
    $f = fopen($filename, "w");
    # Now UTF-8 - Add byte order mark
    fwrite($f, pack("CCC", 0xef, 0xbb, 0xbf));
    fwrite($f, $content);
    fclose($f);
}
$temp = "" . "<h3>Jeu a 15</h3>";
$temp = $temp . "<p>Rapports du " . $date . "</p>";
$temp = $temp . "<table class=\"jeu\" id=\"tableauresultat\"><tr><td class=\"infotitre\">Rapport</td><td class=\"infotitre\">Nombre de grille gagnantes</td><td class=\"infotitre\">Rapports par grille gagnante</td></tr>";
$temp = $temp . getLigne($rapport15_1, $gagnant15_1, $prono15_1, "impaire");
$temp = $temp . getLigne($rapport15_2, $gagnant15_2, $prono15_2, "paire");
$temp = $temp . getLigne($rapport15_3, $gagnant15_3, $prono15_3, "impaire");
$temp = $temp . getLigne($rapport15_4, $gagnant15_4, $prono15_4, "paire");
$temp = $temp . getLigne($rapport15_5, $gagnant15_5, $prono15_5, "impaire");
$temp = $temp . "</table></br>";
if (file_exists($cheminFichier)) {
    unlink($cheminFichier);
}
writeUTF8File($cheminFichier, $temp);