Hi Emiliano,

You may want to look at escaping your $_POST, $_REQUEST, and $_GET variables 
before using them in their raw form.  Otherwise, you may be susceptible to SQL 
injection attacks.

http://us2.php.net/mysql_escape_string

This may also affect the upload of your binary data using SQL, since it is very 
possible for binary data to contain delimiter characters (', ", etc.)

Good luck,
Chris




-----Original Message-----
From: Emiliano Boragina [mailto:emiliano.borag...@gmail.com]
Sent: Sat 1/24/2009 5:01 AM
To: php-db@lists.php.net
Subject: [PHP-DB] INSERT img+ID
 
Hi I have this PHP:

 

<?php 

if(isset($_POST["nombre"]) && isset($_POST["localidad"]) &&
isset($_POST["mail"]) && isset($_POST["nombCreacion"]) &&
isset($_POST["imagen_txt"]) )

{

            $nombre = $_REQUEST["nombre"];

            $localidad = $_REQUEST["localidad"];

            $email = $_REQUEST["mail"];

            $nomCreacion = $_REQUEST["nombCreacion"];

            $creacion = $_REQUEST["imagen_txt"];

            $habilitar = 0;

            $votos = 0;

            

            $base = 'mydb';

            $conexion = mysql_connect ( 'localhost' , 'root' , 'root' );

            mysql_select_db ( $base , $conexion );

                        

            mysql_query ( "INSERT INTO fotografias
(nombre,localidad,email,nomCreacion,creacion,habilitar,votos) VALUES (
'$nombre' , '$localidad' , '$email' , '$nomCreacion' , '$creacion' ,
'$habilitar' , '$votos' )", $conexion);

            

            

            $fecha = date("D-M-y H:i");

            $mymail = "emiliano.mim...@gmail.com";

            $subject = "Contact Form"."<br>"; 

            $contenido .= "Nombre y Apellido: ".$_POST["nombre"]."<br>";

            $contenido .= "Localidad: ".$_POST["localidad"]."<br>";

            $contenido .= "Mail de tus papas: ".$_POST["mail"]."<br>";

            $contenido .= "Nombre de la creaci&oacute;n:
".$_POST["nombCreacion"]."<br>";

            $contenido .= "Foto: <a href='fotos/".$_POST["imagen_txt"]."'>
fotos/".$_POST["imagen_txt"]."</a><br>";

            $contenido .= "Habilitar o Borrar creaci&oacute;n: <a
href='admin/'>Administrador</a><br>";

            $contenido .= "El mensaje se escribio el ".$fecha."<br>"; 

            $header =
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."<br>";

            $header .= "X-Mailer:PHP/".phpversion()."\n"; 

            $header .= "Mime-Version: 1.0\n"; 

            $header = "Content-Type: text/html; charset=utf-8\r\n";

            mail($mymail, $subject, utf8_encode($contenido) ,$header);

            

            echo 'exito=true';

}else{

            echo "nada subio";

}

 

?>

 

I want to insert a JPG image ($creacion) with the ID (from the data base,
MEDIUMINT AUTOINCREMENT): 23image.jpg in the data base, and send the
information to a e-mail addres. How do I do that?

Thanks a lot,

 

+                                                                          _
   // Emiliano Boragina _
   // DiseƱo & ComunicaciĆ³n //////////////////
+                                                                          _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///////////////////////////
+                                                                          _


Reply via email to