Example #1
0
function topluemailgonder($tablo, $alan, $filtre, $subject, $kimden, $mesaj, $replacealanlar, $mesajsayisi = 0)
{
    echo "Toplu email gonderme basladi:";
    global $confdir, $output;
    include $confdir . "dbconf.php";
    $result2 = "";
    $alansayisi = count($alan);
    $replacedalanlar = arrayop($replacealanlar, "strop");
    // alanlar {adi} seklinde basina { ve sonuna } ekler.
    $query = "select * from {$tablo}";
    if ($filtre != "") {
        $query .= " where {$filtre}";
    }
    if ($mesajsayisi > 0) {
        $query .= " limit {$mesajsayisi} ";
    }
    $result = dbquery($query);
    //$output.="query: $query <br>";
    if ($result) {
        $result2 .= "<table><tr><td><ol>";
        while ($r = mysql_fetch_array($result)) {
            $email = $r[$alan];
            $id = $r["id"];
            //$header="";
            //$result2=mail("$email","$subject","$mesaj","$headers");
            //if($result2){ $result2.="<br> mail gonderildi: $mail ";}else{ $result2.="gonderilemedi:$email ";};
            //   include("../mesaj.php");
            //   $mesaj.="\n Gnderilen email: $email";
            $degerler = alanal2($tablo, $replacealanlar, "id={$id}");
            //$output.=print_r2($replacedalanlar).print_r2($degerler);
            $mesaj2 = str_replace($replacedalanlar, $degerler, $mesaj);
            // i�nde {adi} {soyadi} seklinde gecen sablonlarn yerine kiilerin adn soyadn vb. yerletiri.
            //$output.="meaj:".$mesaj2."<br><br>";
            $res = htmlmailgonder($email, $subject, $mesaj2, $kimden);
            if ($res) {
                $result2 .= "<li>email gonderildi:{$email}.</li>";
            } else {
                $result2 .= "<li>gonderilemedi:{$email} </li>";
            }
        }
        $result2 .= "</ol></td></td></table>";
        mysql_free_result($result);
    } else {
        $result2 .= "Bir hata olustu:" . mysql_error();
    }
    $result2 .= "<br>Mail gonderme bitti.<br>";
    return $result2;
}
Example #2
0
 function putArrayToStrDns($arr)
 {
     # we should better code this, we should use existing function putArrayToStr, or reduce code...
     if (!$arr) {
         return "";
     }
     $alanlar = array_keys($arr[0]);
     // gets array keys, from first(0th) array element of two-dimensional $arr array.
     // following code, replaces fields from template to values here in $arr two-dim array. each $arr element written to output file accourding to template file.
     $replacealanlar = arrayop($alanlar, "strop");
     foreach ($arr as $ar1) {
         // template e gore apacehe dosyasn olustur
         // Check which template to really use for DNS
         if ($ar1["dnsmaster"] != '') {
             // Use slave template
             $template = $this->dnsnamedconftemplate_slave;
         } elseif ($ar1["dnsmaster"] == '') {
             // Use master template
             $template = $this->dnsnamedconftemplate;
         }
         $templatefile = file_get_contents($template);
         $temp = $templatefile;
         $temp = str_replace($replacealanlar, $ar1, $temp);
         $out .= $temp;
     }
     return $out;
 }