İyinet'e Hoşgeldiniz!

Türkiye'nin En Eski Webmaster Forum'una Hemen Kayıt Olun!

Kayıt Ol!

Post verilerini filtreleme

LvntAyn

0
İyinet Üyesi
Katılım
2 Şubat 2011
Mesajlar
10
Reaction score
0
Konum
Ordu
Merhaba arkadaşlar güvenlik için post verilerini filtrelemem gerek şöyle bir kod buldum r10'da ama uygulayamadım. Yardımcı olurmusunuz.

PHP:
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 . "'" : "lisanssız";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "lisanssız";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "lisanssız";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "lisanssız";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 

eL_Master

0
İyinet Üyesi
Katılım
2 Aralık 2010
Mesajlar
100
Reaction score
0
biraz kasmışlar sanki
strip_tags addslashes htmlspecialchars bunları kullan.
eğer ?id= gibi değerse ve mysql sorgusu yapacaksan mesela
$id=$_GET['id'];
if((gettype($id)=='integer'){
işlemler gibi
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Üst