Access to cPanel (You have forgotten your data)

Help in line of PegasoWeb

This is the data base of PegasoWeb help in line

And she is filled with answers to the most common questions so that you can solve your doubts to any hour and at any time. We have 30 questions organized in 10 categories. It uses the finder to find answer to the questions that arise to you when you begin to use our services.

If you do not find answer to your question, send a stuffed email to us to support or the form to add it to the data base.

If you finish arriving we recommended to you that you read articles of the category First steps.

Example of mail form

In order to put a mail form you need two things:

  1. A page HTML (or PHP) with the form in himself.
  2. Script that processes the data of the form, sending them to its destiny and notifying the user of the result of the operation.


1) Form HTML

In order to make the form in HTML you can use a design tool type FrontPage or Dreamweaver, or can write directly code HTML following the Recommendation of W3C:

http://html.conclase.net/w3c/html401-es€¦ forms.html

or some of the many tutorials that are in the network.

Basically a mail form consists of the following thing:

<form action= " script to execute€ method= " post " >
[€¦ the contents of the form€¦]
</form>


Within the form they need to us at least button and a text field of shipment. In addition we can pass parameters to ours script of invisible way for the user by means of hidden fields (that are in code HTML but they do not leave by the screen).

For example, this generates a text picture of a line:

<input type= " text€ name= " Subject " >

€œinput type='text'€ means €œentrance type text€. €œname='Asunto'€ is the name that we give him to this field, thus we know to what each field of the form corresponds.

This generates a shipment button:

<input type= " submit€ value= " To send data " >

€œinput type='submit'€ means €œentrance type to send€. €œto value='Enviar datos'€ it is the name that will appear within the button.

A text entrance can be created multiline with an element TEXTAREA, in this way:

<textarea name= " Message " >Escriba here his mensaje</textarea>

Finally, to pass an hidden parameter, the following thing is used:

<input type= " hidden€ name= " recipient€ value= " [email protected] " >

This will send an hidden field with the name €œrecipient€ (adressee) and the value €œ[email protected]€. It is important to specify name and value, otherwise the field will not go to script.

--

2) Script

An enormous variety of scripts exists that allows to send forms to an adressee. Traditionally script in called Perl FormMail was used, but this one has a historial length of security fatal errors that can cause that any person uses her form without you know it.

In PegasoWeb you have three simple alternatives:

 

  • To use the clone of FormMail that comes settled with all the accounts of lodging.
  • To use script PHP created by same you, as we see next.
  • To use script created by one third person.

a) Clone of FormMail.

This script works just as the original FormMail, but without security failures.

You need to write the following thing in your page HTML:

i)
<form action= " http://www.tudominio.com/cgi-sys/FormMail.cgi€ method= " post " >

II)
To include an hidden field in its form with the direction of the adressee of the following way:

<input type= " hidden€ name= " recipient€ value= " [email protected] " >

The important one that the specified direction belongs to the domain lodged with PegasoWeb, otherwise will not work the form.

III)
Optionally, you can include a text field €œrealname€ for the real name of the sender, another field €œemail€ for his email address (not recommended) and another field €œsubject€ for the subject of the message.

In addition you can include an hidden field to redirigir to the user if the shipment were successful:

<input type= " hidden€ name= " redirect€ value= " http://www.tudominio.com/exito.html " >

And you can specify what fields are obligatory and to specify a page to which it will be redirigir¡ to the user if there were some error:

<input type= " hidden€ name= " required€ value= " name, subject " >
<input type= " hidden€ name= " missing_fields_redirect€ value= " http://www.tudominio.com/error.html " >

For more options, it consults in:
http://www.scriptarchive.com/readme/formmail.html

This it is an example of a complete typical form:

<form action= " http://www.tudominio.com/cgi-sys/FormMail.cgi€ method= " post " >
<p>Nombre: <input type= " text€ name= " name€ value= "" ></p>
<p>E-mail: <input type= " text€ name= " mail€ value= "" ></p>
<p>Asunto: <input type= " text€ name= " subject€ value= "" ></p>
<p><textarea name= " message " >Escriba here his mensaje</textarea></p>
<p>
<input type= " submit€ value= " To send message " >
<input type= " hidden€ name= " recipient€ value= " [email protected] " >
<input type= " hidden€ name= " redirect€ value= " http://www.tudominio.com/exito.html " >
<input type= " hidden€ name= " required€ value= " name, mail, subject, message " >
<input type= " hidden€ name= " missing_fields_redirect€ value= " http://www.tudominio.com/error.html " >
</p>
</form>

b) With script PHP.

The problem of the previous method is that your email address is in page HTML, of where can be read easily by robots search managed by esp¡mers to espamear your mailbox. This is easy to remedy if the direction of the adressee within script is included, and not within page HTML. With PHP he is very simple to create a mail form.

In order to begin, code HTML could be simpler:

<form action= " http://www.tudominio.com/miform.php€ method= " post " >
<p>Nombre: <input type= " text€ name= " name€ value= "" ></p>
<p>E-mail: <input type= " text€ name= " mail€ value= "" ></p>
to <p>Confir its e-mail to me: <input type= " text€ name= " to confirm€ value= "" ></p>
<p>Tel©fono: <input type= " text€ name= " telephone€ value= "" ></p>
<p><textarea name= " message " >Escriba here his mensaje</textarea></p>
<p><input type= " submit€ value= " To send message " ></p>
</form>

Code PHP would verify that the user has specified all the obligatory fields and next sends it with the function mail:

miform.php:

<? php
//the variables must exist and not be empty;
//on the contrary redirigimos to the error page and we left:

$req = Array (€˜name€™, €˜mail€™, €˜to confirm€™, €˜telephone€™, €˜message€™);
foreach ($req ace $campo) \ {
    $_POST [$campo] = trim ($_POST [$campo]);
    if ($_POST [$campo] == "") salir_con_error ();
}

if ($_POST [€˜mail€™]! = $_POST [€˜to confirm€™]) salir_con_error ();

function salir_con_error () \ {
    to header (€œLocation: http://www.tudominio.com/error.html€);
    exit;
}

//If there is no error, we sent the mail and redirigimos to the page of
//success. The function mail () has 4 arguments: adressee, subject,
//body of the message, and headed additional

$cuerpo = sprintf (
    €œMessage of %s <%s> (%s)€,
    $_POST [€˜name€™], $_POST [€˜mail€™], $_POST [€˜telephone€™]
);
$cuerpo. = €œCommentaries: €. $_POST [€˜message€™]. € €œ;

mail (
    €œ[email protected]€, €œMessage from the Web€, $cuerpo, €œFrom: [email protected]€
);

to header (€œLocation: http://www.tudominio.com/exito.html€);
exit;
>

This code PHP it copies in a it, text file guards with the name miform.php, and you raise it your space Web, the same directory where it is your form. You will also need to raise the pages error.html and exito.html the correct directory.

€œTo return to the index of the category