Ir para conteúdo
Entre para seguir isso  
Firework

[WebSite] ContactForm

Recommended Posts

Firework    0
Firework

ContactForm

By: Doni Ronquillo

 

Este script serve para fazer receber e-mails ou comentários de seus visitantes muito mais fácil. Todos os visitantes têm a fazer é preencher um formulário simples e clique em enviar. Requisitos: - PHP 4 Instalação: As instruções de instalação estão incluídas em no final do topico.

 

Chega de bla bla bla *--*

 

Passo 1 -

Crie uma pasta com o Nome de ContactForm

E coloque os seguintes arquivos nela:

 

[spoiler=contact]

<?


  include('inc/config.inc');

   if ($_SERVER['REQUEST_METHOD'] == "POST") {

     $name     = $_POST[name];
     $email    = $_POST[email];
     $company  = $_POST[company];
     $phone    = $_POST[phone];
     $website  = $_POST[website];
     $msg      = $_POST[msg];
     $subject  = $_POST[subject];

     // $msg2 is set in config.inc which formats the body of the message
      mail("$adminemail[$who]", "$subjectheader $subject", "$msg2", "From: $email \nReply-To: $email");

     if ($redirecturl != "") {
        header("Location: $redirecturl");
     } else {
        echo "<br><center>$finishedtext</center><br>";
     }

   } else {
     include($script_dir . '/inc/header.php');
      include($script_dir . '/inc/contactform.php');
     include($script_dir . '/inc/footer.php');
   }
?>

 

 

Passo 2 -

Dentro da pasta ContactForm crie uma pasta chamada inc.

E coloque os seguintes arquivos nela:

 

[spoiler=config]

<?

# script name
$scriptname = "Contact Form";

# use full paths
# not using full paths could prevent the script from functioning properly

# script directory # no trailing slash
$script_dir = "/home/www/ContactForm";

# script url (url to script directory above)
# no trailing slash
$script_url = "Url do Script";

# variables below corresponds to the Email to * in your contact form
# match the numbers to the value for which option maps to a specific email
# you can add more as long as you keep them in sync

$adminemail[1] = "[email protected]";
$adminemail[2] = "[email protected]";
$adminemail[3] = "[email protected]";

# preceeds the subject the user puts in on the contact form
$subjectheader = "[Contact Form]:";

# url the form will redirect to after sending email
$redirecturl = "Para onde redirencionar após enviar.;

# text that will display if you leave above variable blank
$finishedtext = "Thank you for your inquiry. We will reply ASAP!";

# how the message will show in the email
# you can reorder these how you wish or modify the message itself to your liking
# just be sure and leave the $variables in tact

$msg2 = "
   Name: $name
   Email: $email
   Company: $company
   Phone: $phone
   Website: $website
   Message:$msg
";
?>

 

 

[spoiler=contactform]

<SCRIPT LANGUAGE="JavaScript">
   <!-- Hide code from non-js browsers
   function validate()
   {
       formObj = document.contact;
       if ((formObj.name.value == "") ||
           (formObj.email.value  == "") ||
           (formObj.subject.value  == "") ||
           (formObj.msg.value  == ""))
       {
           alert("You have not filled in all required fields.");
           return false;
       }
       else {
           alert('<? echo $finishedtext; ?>');
           return true;
       }
   }
   // end hiding -->
</SCRIPT>

<TABLE BORDER=0 cellpadding=5 cellspacing=0>
 <TR>
   <TD>
      <TABLE BORDER=0 cellpadding=2 cellspacing=0>
        <form action="<? echo $script_url; ?>/contact.php" method="post" name="contact" onSubmit="return validate()">
        <TR>
          <TD>
               <BR>
               <DIV>
               1. Name *<BR>
               <input type=text value='your name' size=50 maxlength=50 name=name class='txtfield'><BR>

               2. Email Adress *<BR>
               <input type='text' value='[email protected]' size='50' maxlength='60' name='email'><BR>

               3. Company Name<BR>
               <input type='text' value='your company' size='50' maxlength='50' name='company'><BR>

               4. Phone Number<BR>
               <input type='text' value='(000) 000-0000' size='50' maxlength='32' name='phone'><BR>

               5. Webiste<BR>
               <input type='text' value='http://www.yoursite.com' size='50' maxlength='60' name='website'><BR>

               6. Email to *<BR>
               <select name='who'>
               <option value='1'>Customer Service</option>
               <option value='2'>Information</option>
               <option value='3'>Technical Support</option>
               </select><BR>

               7. Subject *<BR>
               <input type='text' value='' size='50' maxlength='60' name='subject'><BR>

               8. Message *<BR>
               <textarea name='msg' rows='7' cols='50'></textarea><BR>

               </DIV>

               <input type='submit' value='submit'>* Field Required<BR>

         </TD>
       </tR>
       </FORM>
     </tABLE>
   </TD>
 </TR>
</tABLE>

 

 

[spoiler=header]

<HTML>
<HEAD>

   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title><? echo $scriptname; ?></title>
   <META name="description" content="">
   <META name="keywords" content="">
   <META name="revisit-after" content="7days">
   <META name="robots" content="index, follow">

</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 rightmargin=0>
<center><br>{placeholder for header html here}<br>

 

 

Obrigado pela a atenção!

Até o proximo!

 

Bonus - Instalação PHP 4

 

Passo 1 -

 

 

Editar inc / config.inc para refletir as configurações no seu servidor e os US $ adminEmail [n] (onde n é um valor inteiro) variável para coincidir com seu endereço de email que corresponde ao "E-mail para *" seleção em "inc / ContactForm.php".

 

Passo 2 -

 

Faça o upload dos arquivos de script para o servidor.

Para modificar a aparência do formulário de contato editar "inc / ContactForm.php"

 

Resolução de Problemas

 

Certifique-se de todos os caminhos são caminhos uso correto completa, se necessário.

Editado por Firework

Compartilhar este post


Link para o post
Velho Doidao    2
Velho Doidao

Obrigado pela contribuição, Aprovado.

Compartilhar este post


Link para o post
xxgustavorx    0
xxgustavorx

Tenho um em php bem mais facil de mcher

Compartilhar este post


Link para o post
Striker_Sky    0
Striker_Sky

Funfando, vlw pelos códigos =D

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×