Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST["chave"]) AND $_POST["chave"]=="33sio5IBXW2hFoTT"){
- $css="{background: #FFD1D1 !important; border: 1px solid #F8ACAC !important;}";
- $id_error_fields=array();
- if (isset($_POST["name"]) AND strlen($_POST["name"])>=5)
- {
- $name=$_POST["name"];
- }
- else{
- $name=$_POST["name"];
- array_push($id_error_fields, "name");
- }
- if (isset($_POST["morada"]) AND strlen($_POST["morada"])>=5)
- {
- $morada=$_POST["morada"];
- }else{
- $morada=$_POST["morada"];
- array_push($id_error_fields, "morada");
- }
- if (isset($_POST["codpostal"]) AND strlen($_POST["codpostal"])>=7)
- {
- $codpostal=$_POST["codpostal"];
- }else{
- $codpostal=$_POST["codpostal"];
- array_push($id_error_fields, "codpostal");
- }
- if (isset($_POST["localidade"]) AND strlen($_POST["localidade"])>=3)
- {
- $localidade=$_POST["localidade"];
- }else{
- $localidade=$_POST["localidade"];
- array_push($id_error_fields, "localidade");
- }
- if (isset($_POST["escolhauni"]) AND strlen($_POST["escolhauni"])>=1)
- {
- $escolhauni=$_POST["escolhauni"];
- }else{
- array_push($id_error_fields, "escolhauni");
- }
- if (isset($_POST["email"]) AND filter_var($_POST["email"], FILTER_VALIDATE_EMAIL))
- {
- $email=$_POST["email"];
- }else{
- $email=$_POST["email"];
- array_push($id_error_fields, "email");
- }
- if (isset($_POST["phone"]) AND strlen($_POST["phone"])>8)
- {
- $phone=$_POST["phone"];
- }else{
- $phone=$_POST["phone"];
- array_push($id_error_fields, "phone");
- }
- if (isset($_POST["montanteminimo"]) AND strlen($_POST["montanteminimo"])>1)
- {
- $montanteminimo=$_POST["montanteminimo"];
- }else{
- $montanteminimo=$_POST["montanteminimo"];
- array_push($id_error_fields, "montanteminimo");
- }
- if (isset($_POST["montantemaximo"]) AND strlen($_POST["montantemaximo"])>1)
- {
- $montanteminimo=$_POST["montantemaximo"];
- }else{
- $montanteminimo=$_POST["montantemaximo"];
- array_push($id_error_fields, "montantemaximo");
- }
- if (isset($_POST["message"]) AND strlen($_POST["message"])>8)
- {
- $message=$_POST["message"];
- }else{
- $message=$_POST["message"];
- array_push($id_error_fields, "message");
- }
- if (count($id_error_fields)>0){
- $type_error="alert";
- $error_text="Corrija os Campos a vermelho!";
- $script='<script type="text/javascript">window.onload = function() {';
- foreach ($id_error_fields as $id_error_field){
- $id_error_field="error_".$id_error_field;
- $script.='document.getElementById("'.$id_error_field.'").className="error";';
- }
- $script.="}</script>";
- }else{
- if($escolhauni=="escolhauni_cartao")
- $text_escolhauni="Cartão Unibanco";
- else
- $text_escolhauni="Crédito Pessoal";
- require_once("./function/function_post_send_email.php");
- $map = array('á' => 'a','º' => '','ª' => '','à' => 'a','ã' => 'a','â' => 'a','é' => 'e','è' => 'e','ê' => 'e','í' => 'i','ì' => 'i','ó' => 'o','ò' => 'o','ô' => 'o','õ' => 'o','ú' => 'u','ù' => 'u','ü' => 'u','ç' => 'c','Á' => 'A','À' => 'A','Ã' => 'A','Â' => 'A','É' => 'E','È' => 'E','Ê' => 'E','Í' => 'I','Ì' => 'I','Ó' => 'O','Ò' => 'O','Ô' => 'O','Õ' => 'O','Ú' => 'U','Ù' => 'U','Ü' => 'U','Ç' => 'C');
- $nome_sem_acentos= strtr($name, $map);
- $headers= 'MIME-Version: 1.0' . "\r\n";
- $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n" .
- "From: " . $nome_sem_acentos . "<" . $email . ">"."\r\n" .
- "Reply-To: " . $email . "\r\n" .
- "Return-Path: " . $email . "\r\n";
- //--------------------------------------------------Fim Headers
- //--------------------------------------------------Construção de mensagem
- $raw_mensage = '<html><body>
- <h1>Pedido Crédio - Site - Pontopay:</h1>
- <table>
- <tr><th>Nome:</th><td>'.$name.'<td><tr>
- <tr><th>Morada:</th><td>'.$morada.'<td><tr>
- <tr><th>Código Postal:</th><td>'.$codpostal.'<td><tr>
- <tr><th>Localidade:</th><td>'.$localidade.'<td><tr>
- <tr><th>Email:</th><td>'.$email.'<td><tr>
- <tr><th>Telefone / Telemóvel:</th><td>'.$phone.'<td><tr>
- <tr><th>Tipo de Crédito:</th><td>'.$text_escolhauni.'<td><tr>
- <tr><th>Mensagem:</th><td><blockquote>'.$message.'</blockquote><td><tr>
- </body></html>';
- $raw_mensage = wordwrap($raw_mensage, 70);
- //--------------------------------------------------Fim Construção de mensagem
- //--------------------------------------------------Assunto do Email
- $title_email="Pedido Crédito - Site - Pontopay";
- //--------------------------------------------------Fim Assunto do Email
- //--------------------------------------------------Servidor de envio onde está o ficheiro de envio
- $config = parse_ini_file("./config.ini", true);
- $write_log=$config["config"]["write_log"];
- $hostname=$config["config"]["hostname"];
- $default_server = $config["master_server"]["url_server"];
- //--------------------------------------------------Email de recepção
- $para=$config["config"]["send_mail_admin"];
- //--------------------------------------------------Fim Email de recepção
- //--------------------------------------------------Fim Servidor de envio onde está o ficheiro de envio
- if (post_send_email($para, $title_email, $raw_mensage, $headers, $default_server)){
- $type_error="success";
- $error_text="A sua mensagem foi enviada com sucesso, responderemos brevemente. Obrigado!";
- unset($name);
- unset($morada);
- unset($codpostal);
- unset($localidade);
- unset($email);
- unset($phone);
- unset($montanteminimo);
- unset($montantemaximo);
- unset($escolhauni);
- unset($message);
- }else{
- $type_error="alert";
- $error_text="Ocorreu um erro e a sua mensagem não foi enviada, tente novamente mais tarde!";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement