elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: [1]
1  Informática / Tutoriales - Documentación / Re: Tutorial de Inyección SQL (SQL Injection) en: 6 Mayo 2008, 15:45 pm
para evitar la inyeccion usar esta funcion:

Código:


 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 "text2":
      $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;
case "like":
      $theValue = ($theValue != "") ? "'%" . $theValue . "%'" : "NULL";
      break;
case "likedespues":
      $theValue = ($theValue != "") ? "'" . $theValue . "%'" : "NULL";
      break;
case "likeantes":
      $theValue = ($theValue != "") ? "'%" . $theValue . "'" : "NULL";
      break;
  }
  return $theValue;
}
}

Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines