INSERT img+ID

------=_NextPart_000_0007_01C97E0A.B1343050
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi I have this PHP:



<?php

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

{

$nombre =3D $_REQUEST["nombre"];

$localidad =3D $_REQUEST["localidad"];

$email =3D $_REQUEST["mail"];

$nomCreacion =3D $_REQUEST["nombCreacion"];

$creacion =3D $_REQUEST["imagen_txt"];

$habilitar =3D 0;

$votos =3D 0;



$base =3D 'mydb';

$conexion =3D 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 =3D date("D-M-y H:i");

$mymail =3D "emiliano.mimail [at] gmail.com";

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

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

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

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

$contenido .=3D "Nombre de la creación:
".$_POST["nombCreacion"]."<br>";

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

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

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

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

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

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

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

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



echo 'exito=3Dtrue';

}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=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina [at] gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_


------=_NextPart_000_0007_01C97E0A.B1343050--
Emiliano Boragina [ Sa, 24 Januar 2009 14:01 ] [ ID #1986451 ]

RE: INSERT img+ID

------_=_NextPart_001_01C97E40.9C1A5D30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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.boragina [at] gmail.com]
Sent: Sat 1/24/2009 5:01 AM
To: php-db [at] 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 =3D $_REQUEST["nombre"];

$localidad =3D $_REQUEST["localidad"];

$email =3D $_REQUEST["mail"];

$nomCreacion =3D $_REQUEST["nombCreacion"];

$creacion =3D $_REQUEST["imagen_txt"];

$habilitar =3D 0;

$votos =3D 0;



$base =3D 'mydb';

$conexion =3D 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 =3D date("D-M-y H:i");

$mymail =3D "emiliano.mimail [at] gmail.com";

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

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

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

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

$contenido .=3D "Nombre de la creación:
".$_POST["nombCreacion"]."<br>";

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

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

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

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

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

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

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

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



echo 'exito=3Dtrue';

}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=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina [at] gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_



------_=_NextPart_001_01C97E40.9C1A5D30--
Chris Verges [ Sa, 24 Januar 2009 17:25 ] [ ID #1986453 ]

Re: INSERT img+ID

> 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?

There are plenty of tutorials/examples of this around.

Search for something like "mysql insert image database".

Here's one example: http://hockinson.com/index.php?s=37 (even with a
downloadable script).

Most people suggest storing the filename with the database record, and
leaving the actual image in a particular folder.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
dmagick [ Mo, 26 Januar 2009 23:22 ] [ ID #1986681 ]

Re: INSERT img+ID

On Sat, Jan 24, 2009 at 7:01 AM, Emiliano Boragina
<emiliano.boragina [at] gmail.com> wrote:
>
> 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=F1o & Comunicaci=F3n //////////////////

mysql_insert_id
http://us3.php.net/manual/es/function.mysql-insert-id.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Dee Ayy [ Fr, 13 Februar 2009 19:57 ] [ ID #1989282 ]
PHP » gmane.comp.php.database » INSERT img+ID

Vorheriges Thema: Aborting long running DB queries with browser "Stop" button
Nächstes Thema: session variable in select query showing picture from database