Ver Mensaje Individual
  #17 (permalink)  
Antiguo 18/10/2013, 15:28
Avatar de zreep
zreep
 
Fecha de Ingreso: octubre-2009
Ubicación: Argentina
Mensajes: 534
Antigüedad: 15 años, 4 meses
Puntos: 12
Respuesta: PDO y la seguridad

Bueno gracias a todos, andresdzphp, Triby, pateketrueke por ayudar a este cabeza dura...

Por ultimo le muestro como me quedo el code:

Código PHP:
try {
    
$con = new PDO('mysql:host=localhost;dbname=base','root','pas');
    }
catch (
PDOException $e){
    echo 
"Failed to get DB handle: ".$e->getMessage()."";
    exit;

Código PHP:
session_start();

if(isset(
$_POST['enviar'])){
    if(!empty(
$_POST['user'])){
       
$stmt $con->prepare("SELECT * FROM usuario WHERE pass='".$_POST['user']."'");
       
$stmt->execute();
       
$fila $stmt->fetch();       
            if(
$fila 0){
             
$_SESSION['logueado'] = "SI";
             
$_SESSION['usuario']  = $fila['nombre'];
            } else {
                echo 
"<span style='color: red;'>Usuario incorrecto</span>";
            }
    }

Por otro lado no use "bindValue" por ahora, por que no lei eso.

Gracias nuevamente por todo.
__________________
Zreep