Busque en el foro numerosas clases de envio pero no encontre exactamente lo que necesito, y ademas, como soy novato en el tema, no tengo del todo claro algunos conceptos.
aca les paso el codigo. Tiene un par de lineas de comprobacion de sesion y de validacion del formulario que coloco con macromedia dreamweaver. No presten atencion a eso :xD . Saludos y gracias de antemano
Código PHP:
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<html>
<head>
<title>Tantis.Com.Ar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="estilos/tantis.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<div align="left" class="TITULO-CATEGORIA">contacto</div>
<p><br>
<span class="FORMULARIOS"><strong>formulario de contacto </strong></span></p>
<p class="FORMULARIOS">si desea adquirir una cuenta pop3 (ej.: [email protected]) <br>
solicítelo por esta via, indicando su usuario y password deseado,<br>
y le daremos el alta a la brevedad. </p>
<table width="36%" border="0">
<tr>
Código PHP:
<?
if (!$HTTP_POST_VARS){
?>
<p align="left"><span class="FORMULARIOS">Nombre:</span><br>
<input name="nombre" type="text" class="campos" id="nombre" size="58">
<br>
</p>
<p align="left"><span class="FORMULARIOS">email:<br>
</span>
<input name="email" type="text" class="campos" id="email" size="58">
<span class="fechas"> </span> </p>
<p align="left"><span class="FORMULARIOS">comentario</span> <br>
<textarea name="comentario" cols="60" rows="5" wrap="VIRTUAL" class="campos" id="comentario"></textarea>
</p>
<p align="right"><br>
<input name="id_nuevo" type="hidden" id="id_nuevo" value="<?php $row_libro ['id_libro'] +1 ?>">
<input name="fecha" type="hidden" id="fecha" value="<? echo date("y"),"/",date("m"),"/",date("d")?>">
<input name="usuario_web" type="hidden" id="usuario_web">
<input name="imageField" type="image" src="imagenes/BOTON_ENVIAR.gif" align="right" width="70" height="28" border="0">
</p>
</form></td>
Código PHP:
<?
}else{
//Estoy recibiendo el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Nombre: " . $HTTP_POST_VARS["nombre"] . "\n";
$cuerpo .= "Email: " . $HTTP_POST_VARS["email"] . "\n";
$cuerpo .= "Comentarios: " . $HTTP_POST_VARS["comentario"] . "\n";
//mando el correo...
mail("[email protected]","Consulta / Solicitud Via Web",$cuerpo);
//doy las gracias por el envío
echo '<span class="FORMULARIOS">Gracias por completar el formulario.<br>Se ha enviado correctamente.</span>';
}
?>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>