Google Fan Webmaster Forum - Tekil Mesaj Gösterimi - Sizce En Doğrusu ve Güvenlisi ?
Tekil Mesaj Gösterimi
  #4 (permalink)  
Eski 12-05-2008, 14:12:52
Bartuc - ait Avatar
Bartuc Bartuc isimli üyemiz çevrimdışıdır. (Offline)
phpministraktör
 
Kütahya Şubesi
Nerden: unknown origin..
Mesajlar: 2.237
Thanks: 0
Thanked 0 Times in 0 Posts
iTrader Puanı: (47)
iTrader Feedback: (100%)
Rep puanı: 151
Bartuc isimli üyemiz daha yolun başında.Bartuc isimli üyemiz daha yolun başında.
Bartuc - MSN üzerinden Mesaj gönder
Tanımlı

sprintf kullanman en güzeli.

mysql_query(sprintf(".......... WHERE uyeno='%s'", $uyeno), $baglanti);

Eğer güvenliği de bu kodla sağlamak istiyorsan, benim hep kullandığım fonksiyonu kullan ve aynen şöyle yap:
PHP Kodu:
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

mysql_query(sprintf(".......... WHERE uyeno=%s"GetSQLValueString($uyeno"int")), $baglanti); 
__________________
[SIGPIC][/SIGPIC]
Alıntı ile Cevapla