cMg Web

Internet Explorer’da Cookie Sorunu

Posted by: cemg on: 30 Kasım, 2009

Php ile oluşturduğumuz Cookie’lerde Cookie içerisindeki değeri Internet Explorer otomatik olarak C:\Documents and Settings\Cem\Cookies gibi bir klasör altında saklar.

Php’de Cookie tanımlamak için kullandığımız;

setcookie(“isim”,”cem”,time()+3600)

yapısında belirtilen time()+3600 ile bu belirlediğimiz bilginin 3600 saniye boyunca tarayıcıda bu klasör altında saklanacağını belirtmiş oluyoruz.

Sorun şu ki Internet Explorer 7200 saniye’nin aşağısındaki cookie’leri hiç saklamıyor ve otomatik siliyor. Bu da demek oluyor ki 7200 den aşağıda bir değer belirtmeyeceğiz. Ya da belirteceğiz göremiyeceğiz.

NOT: Firefox’da Araçlar->Seçenekler->Gizlilik menüsü altından çerezlere bakılabilir.

Etiketler: , ,

Döviz Kurları

Posted by: cemg on: 27 Kasım, 2009

<?
$currency=array("USD" => "",);
$currency2=array("EUR" => "",);
$convert=array("ForexBuying"     => "Alış",);
$convert2=array("ForexSelling"    => "Satış",);
$convert3=array("ForexBuying"     => "Alış",);
$convert4=array("ForexSelling"    => "Satış",);
$content=file_get_contents("http://www.tcmb.gov.tr/kurlar/today.xml");

foreach($currency as $code => $arr){
preg_match(“‘<currency Kod=\\”(“.$code.”)”.*>(.*)</currency>’Uis”,$content,$crst);
preg_match(“‘<currency Kod=\\”(“.$code.”)”.*>(.*)</currency>’Uis”,$content,$crst2);
foreach($convert as $field => $value){
preg_match(“‘<”.$field.”>(.*)</”.$field.”>’Uis”,$crst[2],$frst);
$currency[$code][$value]=$frst[1];
}

foreach($convert2 as $field => $value){
preg_match(“‘<”.$field.”>(.*)</”.$field.”>’Uis”,$crst2[2],$frst2);
$currency[$code][$value]=$frst2[1];
}
}
foreach($currency2 as $code => $arr){
preg_match(“‘<currency Kod=\\”(“.$code.”)”.*>(.*)</currency>’Uis”,$content,$crst3);
preg_match(“‘<currency Kod=\\”(“.$code.”)”.*>(.*)</currency>’Uis”,$content,$crst4);
foreach($convert3 as $field => $value){
preg_match(“‘<”.$field.”>(.*)</”.$field.”>’Uis”,$crst3[2],$frst3);
$currency[$code][$value]=$frst3[1];
}

foreach($convert4 as $field => $value){
preg_match(“‘<”.$field.”>(.*)</”.$field.”>’Uis”,$crst4[2],$frst4);
$currency[$code][$value]=$frst4[1];
}
}
?>

<table cellpadding=”0″ cellspacing=”0″ valign=”top” align=”center”>
<tr><td rowspan=”2″ align=”center”>Dolar
</td><td>Alış</td><td><?=$frst[1];?></td></tr>
<tr><td>Satış</td><td><?=$frst2[1];?></td></tr>
<tr><td rowspan=”2″
align=”center”>Euro</td><td>Alış</td><td><?=$frst3[1];?></td></tr>
<tr><td>Satış</td><td><?=$frst4[1];?></td></tr>
</table>

Temel Tarih ve Saat Ekleme

Posted by: cemg on: 26 Kasım, 2009

<?php
$tarih = date('d.m.Y');
$saat  = date('H:i:s'); //
date('G:i:s')
echo "Tarih: $tarih" . "<br>";
echo "Saat: $saat";
?>
Etiketler: , ,

Veritabanından Toplu Email Göndermek

Posted by: cemg on: 26 Kasım, 2009

<? 
ob_start();  

$tablo_adi            = ""; 
$tablo_sutun            = "";  

$mail_sayi_sorgu = mysql_query("SELECT COUNT(*) FROM $tablo_adi"); 
list($mail_sayi_sonuc) = mysql_fetch_row($mail_sayi_sorgu); 
mysql_free_result($mail_sayi_sorgu);  

$basla                = $_GET["basla"] ? $_GET["basla"] : 0; 
$limit                = 1; 
$bekle                = 2;  

$konu                = "";  
$mesaj                = "";  

$ustk                = "From: xxx <info@pehepe.org>\n";  
$ustk                .= "X-Sender: <info@pehepe.org>\n";  
$ustk                .= "X-Mailer: PHP\n";  
$ustk                .= "X-Priority: 3\n";  
$ustk                .= "Return-Path: <info@pehepe.org>\n";  
$ustk                .= "Content-Type: text/html; charset=iso-8859-9\n";   

$mail_sorgu = mysql_query("SELECT $tablo_sutun FROM $tablo_adi limit $basla,$mail_sayi_sonuc"); 
$mail_sonuc = mysql_fetch_object($mail_sorgu); mysql_free_result($mail_sorgu); 
$mail_adres = $mail_sonuc->eposta;  

mail($mail_adres, $konu, $mesaj, $ustk);   

echo "<b> Alıcı : </b>$mail_adres <br>"; 
echo "<b>Gönderilen :</b> $basla <br>"; 
echo "<b>Kalan :</b>"; echo $mail_sayi_sonuc-$basla; echo " <br>";  

if($mail_sayi_sonuc > $basla+$limit){  
 header("refresh: $bekle; url=index.php?basla=".($basla+$limit)); 
}  
?> 
DB den gelen mail listesine aynı anda mail atmak için kullanılır.
Etiketler: , , ,

Toplu Email Göndermek

Posted by: cemg on: 26 Kasım, 2009

<?
ob_start();   

$basla = $_GET["basla"] ? $_GET["basla"] : 0; // Kactan baslayacak?
$limit = 5;                                   // Kac tanesıne gonderecek?
$bekle = 2;                                   // Kac sanıye bekleyecek?   

$konu  = "Test";
$mesaj = "<b>...</b>";   

$ustk  = "From: xxx <xxx@xxx.com>\\n";
$ustk .= "X-Sender: <xxx@xxx.com>\\n";
$ustk .= "X-Mailer: PHP\\n";
$ustk .= "X-Priority: 3\\n";
$ustk .= "Return-Path: <xxx@xxx.com>\\n";
$ustk .= "Content-Type: text/html; charset=iso-8859-9\\n";   

if($dosya = (fopen("mail.txt",'r'))){
 while(!feof($dosya)){
 $satir  = trim(fgets($dosya,50));
 if($satir != "") $mail[] = $satir;
 }
 fclose($dosya);   

 for($i=$basla; $i<$basla+$limit; $i++){
 if($mail[$i] != ""){
 echo $mail[$i]."<br>";
 mail($mail[$i], $konu, $mesaj, $ustk);
 }
 }   

 echo "<br>Gönderilen $basla, ".($basla+$limit)." arası toplam ".($basla+$limit)." mail. ";
 if(count($mail) > ($basla+$limit)){
 echo "Kalan ".(count($mail) - ($basla+$limit))." mail.";
 header("refresh: $bekle; url=mail.php?basla=".($basla+$limit)); // Sayfayı yenıle
 }
}else {
 echo "Hata: Dosya açılamıyor.";
}
?>
Dosya adı mail.php
Etiketler: ,

PHP ile Gün Hesapları

Posted by: cemg on: 26 Kasım, 2009

<?php
echo strtotime("now"), "\\n";
// bugün
echo strtotime("10 September 2000"), "\\n";
// 10 eylül 2000
echo strtotime("+1 day"), "\\n";
// bir gün sonrası
echo strtotime("+1 week"), "\\n";
// bir hafta sonrası
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\\n";
// bir hafta 2 gün 4 saat 2 saniye sonrası
echo strtotime("next Thursday"), "\\n";
// en yakın perşembe
echo strtotime("last Monday"), "\\n";
// son pazartesi
?>
Etiketler: , , , ,

ASP ile Word Belgeleri Oluşturma

Posted by: cemg on: 9 Eylül, 2008

<%
Response.ContentType = “application/msword”
Response.AddHeader “Content-Disposition”, “attachment;filename=NAME.doc”
response.Write(“Dotnetindex.com : Visit Site” & vbnewline)
response.Write(“We can use HTML codes for word documents”)
response.Write (” CSS can be used tooo”)
%>

ASP ile Excel Dosyası Oluşturma

Posted by: cemg on: 9 Eylül, 2008

<%
Response.AddHeader “Content-Disposition”, “attachment;filename=members.xls”
Response.ContentType = “application/vnd.ms-excel”
response.write “<table width=”100%” border=”1″ >”
response.write “<tr>”
response.write “<th width=”"40%”"><b>Name</b></th>”
response.write “<th width=”"30%”"><b>Username</b></th>”
response.write “<th width=”"30%”"><b>Password</b></th>”
response.write “</tr>”
response.write “<tr>”
response.write “<td width=”"40%”">Scud Block</td>”
response.write “<td width=”"30%”">scud@gazatem.com</td>”
response.write “<td width=”"30%”">mypassword</td>”
response.write “</tr>”
response.write “</table>”
%>