INSERT img+ID
am 24.01.2009 14:01:11 von Emiliano Boragina
------=_NextPart_000_0007_01C97E0A.B1343050
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi I have this PHP:
=20
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;
=20
$base =3D 'mydb';
$conexion =3D mysql_connect ( 'localhost' , 'root' , 'root' =
);
mysql_select_db ( $base , $conexion );
=20
mysql_query ( "INSERT INTO fotografias
(nombre,localidad,email,nomCreacion,creacion,habilitar,votos ) VALUES (
'$nombre' , '$localidad' , '$email' , '$nomCreacion' , '$creacion' ,
'$habilitar' , '$votos' )", $conexion);
=20
=20
$fecha =3D date("D-M-y H:i");
$mymail =3D "emiliano.mimail@gmail.com";
$subject =3D "Contact Form"."
";=20
$contenido .=3D "Nombre y Apellido: =
".$_POST["nombre"]."
";
$contenido .=3D "Localidad: ".$_POST["localidad"]."
";
$contenido .=3D "Mail de tus papas: ".$_POST["mail"]."
";
$contenido .=3D "Nombre de la creación:
".$_POST["nombCreacion"]."
";
$contenido .=3D "Foto:
href=3D'fotos/".$_POST["imagen_txt"]."'>
fotos/".$_POST["imagen_txt"]."
";
$contenido .=3D "Habilitar o Borrar creación:
href=3D'admin/'>Administrador
";
$contenido .=3D "El mensaje se escribio el ".$fecha."
";=20
$header =3D
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."
";
$header .=3D "X-Mailer:PHP/".phpversion()."\n";=20
$header .=3D "Mime-Version: 1.0\n";=20
$header =3D "Content-Type: text/html; charset=3Dutf-8\r\n";
mail($mymail, $subject, utf8_encode($contenido) ,$header);
=20
echo 'exito=3Dtrue';
}else{
echo "nada subio";
}
=20
?>
=20
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,
=20
+ =
_
// Emiliano Boragina _
// Dise=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_
------=_NextPart_000_0007_01C97E0A.B1343050--
RE: INSERT img+ID
am 24.01.2009 17:25:13 von Chris Verges
------_=_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@gmail.com]
Sent: Sat 1/24/2009 5:01 AM
To: php-db@lists.php.net
Subject: [PHP-DB] INSERT img+ID
=20
Hi I have this PHP:
=20
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;
=20
$base =3D 'mydb';
$conexion =3D mysql_connect ( 'localhost' , 'root' , 'root' =
);
mysql_select_db ( $base , $conexion );
=20
mysql_query ( "INSERT INTO fotografias
(nombre,localidad,email,nomCreacion,creacion,habilitar,votos ) VALUES (
'$nombre' , '$localidad' , '$email' , '$nomCreacion' , '$creacion' ,
'$habilitar' , '$votos' )", $conexion);
=20
=20
$fecha =3D date("D-M-y H:i");
$mymail =3D "emiliano.mimail@gmail.com";
$subject =3D "Contact Form"."
";=20
$contenido .=3D "Nombre y Apellido: =
".$_POST["nombre"]."
";
$contenido .=3D "Localidad: ".$_POST["localidad"]."
";
$contenido .=3D "Mail de tus papas: ".$_POST["mail"]."
";
$contenido .=3D "Nombre de la creación:
".$_POST["nombCreacion"]."
";
$contenido .=3D "Foto:
href=3D'fotos/".$_POST["imagen_txt"]."'>
fotos/".$_POST["imagen_txt"]."
";
$contenido .=3D "Habilitar o Borrar creación:
href=3D'admin/'>Administrador
";
$contenido .=3D "El mensaje se escribio el ".$fecha."
";=20
$header =3D
"From:".$_POST["mail"]."\nReply-To:".$_POST["mail"]."
";
$header .=3D "X-Mailer:PHP/".phpversion()."\n";=20
$header .=3D "Mime-Version: 1.0\n";=20
$header =3D "Content-Type: text/html; charset=3Dutf-8\r\n";
mail($mymail, $subject, utf8_encode($contenido) ,$header);
=20
echo 'exito=3Dtrue';
}else{
echo "nada subio";
}
=20
?>
=20
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,
=20
+ =
_
// Emiliano Boragina _
// Dise=F1o & Comunicaci=F3n //////////////////
+ =
_
// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ =
_
------_=_NextPart_001_01C97E40.9C1A5D30--
Re: INSERT img+ID
am 26.01.2009 23:22:51 von dmagick
> 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
Re: INSERT img+ID
am 13.02.2009 19:57:39 von Dee Ayy
On Sat, Jan 24, 2009 at 7:01 AM, Emiliano Boragina
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