
03/09/2004, 19:46
|
 | | | Fecha de Ingreso: enero-2003 Ubicación: venus >> ((_\
Mensajes: 254
Antigüedad: 22 años, 1 mes Puntos: 1 | |
formulario.php Código PHP: <form method=post action="verificar.php">
<table>
<tr><td class="informacion">
<b>Nombre:</b>
<td>
<input name=name size=25 maxlength=20>
<tr><td class="informacion">
<b>Email:</b>
<td>
<input name=email size=25 maxlength=50>
<tr><td class="informacion">
<b>Asunto:</b>
<td>
<input name=sub size=25 maxlength=50>
<tr><td colspan=2 class="informacion" >
<b>Mensaje:</b> <font size=1><i class="red">(500 caracteres max)</i></font>
<br>
<textarea name=msg rows=4 cols=33 maxlength=500></textarea>
<tr><td align=center colspan=2>
<input type=submit name=send value="Enviar">
<INPUT TYPE="BUTTON" VALUE="Cancelar" ONCLICK="javascript:window.location.href='index.php'">
</table>
</form>
verificar.php Código PHP:
<html>
<head>
<TITLE>Contactos</TITLE>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?php
// Removemos < and > desde el mensaje.
$msg = str_replace("<","",$msg);
$msg = str_replace(">","",$msg);
// configuraciones.
$your_email = '[email protected]';
$your_name = 'Tu Nombre';
$your_link = 'http://www.tusitio.com';
$confirm_sub = 'confirmacion';
$confirm_msg = "<html>
<body>
Hola <b>$name,</b>
<p>
Gracias por enviar un mensaje con el asunto de: $sub.
<br>
Le responderemos a usted, tan pronto como sea posible.
<p>
Gracias otra ves, reciba un cordial saludo
<br><center>
$your_name<br>
Grupo de mi sitio</center>
<p>
<a href=$your_link>$your_link</a>
</body>
</html>";
$contact_msg = "<html>
<body>
$msg
</body>
</html>";
// Begin the sendmail routine.
if ($send) {
if (!$name || !$email || substr_count($email, '@') < 1 ||
substr_count($email, '.') < 1 || !$sub || !$msg) {
echo"
<font size=2 c=f0><b class='red'>
Error!</b></font>
<p>
Hubo un error en uno o mas de los campos por favor corrijalo
<p>
<table>
<tr><td>
<ul>
";
if (!$name) {
print "<font color='red'><li><p class=texte><font color='red'>Escriba su nombre!<br>"; }
if (!$email || substr_count($email, '@') < 1 || substr_count($email, '.') < 1) {
print "<font color='red'><li><p class=texte><font color='red'>Su e-mail es incorrecto!<br>"; }
if (!$sub) {
print "<font color='red'><li><p class=texte><font color='red'>Por favor seleccione un asunto!<br>"; }
if (!$msg) {
print "<font color='red'><li><p class=texte><font color='red'>Por favor escriba un mensaje!";
}?>
<form method=post action="verificar.php">
<table>
<tr><td class="informacion">
<b>Nombre:</b>
<td>
<input name=name size=25 maxlength=20 value=<? echo"".$_POST['name'].""; ?>>
<tr><td class="informacion">
<b>Email:</b>
<td>
<input name=email size=25 maxlength=50 value=<? echo"".$_POST['email'].""; ?>>
<tr><td class="informacion">
<b>Asunto:</b>
<td>
<input name=sub size=25 maxlength=50 value=<? echo"".$_POST['sub'].""; ?>>
<tr><td colspan=2 class="informacion" >
<b>Mensaje:</b> <font size=1><i class="red">(500 caracteres max)</i></font>
<br>
<textarea name=msg rows=4 cols=33 maxlength=500><? echo "$msg"; ?></textarea>
<tr><td align=center colspan=2>
<input type=submit name=send value="Enviar">
<INPUT TYPE="BUTTON" VALUE="Cancelar" ONCLICK="javascript:window.location.href='index.php'">
</table>
</form>
<?
print "
</ul>
</table>
";
}
else {
// Mensaje que recibimos en nuestro email.
mail($your_email, $sub, "
Mensdaje enviado desde el sitio $your_link <br>
de: $name < $email > <br>
IP: $ip <br>
Mensaje <br>
$contact_msg
");
// le enviamos un email al otro.
mail($email, $confirm_sub, $confirm_msg, "From: $your_email");
?>
<script>
setTimeout('history.go(location.href="index.php")', 9000);
</script>
<?
echo"
<b class='texto'><font size=2 color='red'>
Su mensaje ha sido enviado.</b></font>
<p>
Gracias <b>$name,</b>
<br>
Usted recibira un email con la confirmacion del sitio.<br>
Por ahora seras enviado a la pagina principal.
</center>";
}
}
?>
<!-- pie -->
</td></tr></table>
</center>
</body>
</html> espero te sirva de algo, si no sabes sobre php busca en www.google.com tutoriales o manuales sobre PHP
Última edición por macabro; 03/09/2004 a las 19:49 |