Foros del Web » Programando para Internet » PHP »

Que realiza el siguiente codigo PHP?

Estas en el tema de Que realiza el siguiente codigo PHP? en el foro de PHP en Foros del Web. Hola, estoy analizando codigo PHP y acudo aqui para ver si me pueden aclararlo de la mejor manera posible. Tenemos el siguiente codigo en php: ...
  #1 (permalink)  
Antiguo 12/04/2014, 13:18
 
Fecha de Ingreso: febrero-2014
Mensajes: 60
Antigüedad: 10 años, 2 meses
Puntos: 0
Que realiza el siguiente codigo PHP?

Hola, estoy analizando codigo PHP y acudo aqui para ver si me pueden aclararlo de la mejor manera posible. Tenemos el siguiente codigo en php:
Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$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;
}
}
?>
Alguien me podría aclarar de manera mas o menos concisa que ejecuciones o acciones lleva a cabo dicho código? Sería muy de agradecer si me respondiesen :P
  #2 (permalink)  
Antiguo 12/04/2014, 13:49
 
Fecha de Ingreso: abril-2014
Ubicación: Canarias!
Mensajes: 150
Antigüedad: 10 años
Puntos: 10
Respuesta: Que realiza el siguiente codigo PHP?

Para escapar datos en servidores ms-sql y protegerse de vulneribilidades

Resultado tras 10 segundos buscando el código en google
http://www.taringa.net/posts/info/13077891/Evitar-inyeccion-MS-SQL-Server-con-php.html

Etiquetas: mysql, siguiente, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:18.