<?
session_start();
?>
<form  method="POST">
<table border="0" align="center">
<caption><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 11px;
									font-weight: normal;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Para Realizar un pago através de PayPal introduce los datos siguientes:<br>
<br></font></caption>
<tr>
<td ><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Monto</font></td>
</tr>
<tr>
<td><input type="text" name="monto" onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin:0px;'><b>USD</b></font></td>
</tr>									
<tr>
<td><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Descripción del pago</font></td>
</tr>
<tr>
<td colspan="2"><textarea name="descripcion" cols="29"></textarea></td>
</tr>
<tr>
<td><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Mensaje para el cliente</font></td>
</tr>
<tr>
<td colspan="2"><textarea name="mensaje" cols="29"></textarea></td>
</tr>
<tr>
<td><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Correo del cliente</font></td>
</tr>
<tr>
<td colspan="2"><input type="text" name="correo"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Enviar" name="pago"></td>
</tr>
</table>
</form>

<?
 if(isset($_POST['pago'])){
 require("../conectar.php");
 $des=$_POST['descripcion'];
 $monto=$_POST['monto'];
 
 if($monto==""){
		echo "<script>alert('Debes Introducir un monto Para realizar la transacción')
				     window.location.href='pagopaypal.php'
			  </script>";
				   
				 }
				 if($des==""){
				   echo "<script>alert('Debes Introducir una descripción para la Transacción')
				         window.location.href='pagopaypal.php'
				         </script>";
						 
				 }
				 $sql=" SELECT email2 from empleados where id_empleado='$_SESSION[usuario_id]' ";
				 $query=mysql_query($sql);
				 $em=mysql_fetch_array($query);	 
?>
<br>
<br>
<fieldset ><legend>Correo enviado!!!</legend>
 <center>
 <?
 echo"Destinatario:".$_POST['correo']."<br><br>";
echo"Remitente:".$em['email2']."<br><br> Mensaje:";		 
echo$mensaje="<center><table width='400' style='border-collapse:collapse;'><tr><td style='border-bottom:solid 1px black;'>".$_POST['mensaje'];	
 echo$cuerpo="<tr><td style='border-bottom:solid 1px black;' align='center'><font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>Monto A Pagar:</font><strong> $monto <font style='font-family: Trebuchet MS, Tahoma, Verdana;
									font-size: 12px;
									font-weight: normal;
									color: #6F6F6F;
									text-decoration: none;
									padding: 0px;
									margin: 20px;'>USD</font></strong>
									<br>				
									<br>
<form action='https://www.paypal.com/cgi-bin/webscr' target='_blank' method='post'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='hosted_button_id' value='5ESXKWWUMHW9J'>
<input type='hidden' name='business' value='mexicoenrenta@hotmail.com'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='item_name' value='$des'>
<input type='hidden' name='amount' value='$monto'>
<a href='http://mexicoenrenta.com.mx/turisiscom/administrador/autopay.php?descripcion=$des&monto=$monto' target='_blank'><input type='image' src='https://www.paypalobjects.com/WEBSCR-640-20110429-1/en_US/i/btn/btn_buynowCC_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img border='0' src='https://www.paypalobjects.com/WEBSCR-640-20110429-1/es_XC/i/scr/pixel.gif width='1' height='1'></a>
</form></table></center>";

$headers="From:".$em['email2']."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

mail($_POST['correo'],"Pago Via PayPal de Mexico en Renta",$mensaje.$cuerpo,$headers); 

?>
</center>
</fieldset>
<?
 }
?> 
