Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/04/2010, 15:32
etisdemian
 
Fecha de Ingreso: octubre-2009
Mensajes: 357
Antigüedad: 15 años, 4 meses
Puntos: 1
con este codigo que agrega dreamweaver......

con este codigo que agrega dreamweaver......no hay necesidad de ningun codigo mass de seguridad?


de casualidad alguien tiene algun link de las pasos que se deverian hacer para seguridad de php?

Código PHP:
Ver original
  1. <?php
  2. //cosas de seguridad
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.  
  8.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  9.  
  10.   switch ($theType) {
  11.     case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  12.       break;    
  13.     case "long":
  14.     case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  15.       break;
  16.     case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  17.       break;
  18.     case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  19.       break;
  20.     case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  21.       break;
  22.   }
  23.   return $theValue;
  24. }
  25. }
  26.  
  27. $editFormAction = $_SERVER['PHP_SELF'];
  28. if (isset($_SERVER['QUERY_STRING'])) {
  29.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  30. }
  31.  
  32.     function stripslashes_deep($value) {
  33.       $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
  34.       return $value;
  35.       }
  36.     $_POST = array_map('stripslashes_deep', $_POST);
  37.     }
  38.  
  39.  
  40. //fin
  41. ?>