Browse Source

add contacts sendMail

develop
Carmine De Rosa 8 years ago
parent
commit
42625d21fa
  1. 40
      blocks/contactForm.php
  2. 72
      blocks/contactFormSubmit.php
  3. 128
      cgi-bin/functions.inc
  4. 34
      contatti.php
  5. 62
      css/styles.css
  6. 4
      farmacie.php
  7. BIN
      images/logo.png
  8. 2
      index.php
  9. 8
      js/scripts.js
  10. 4
      parafarmacie.php
  11. BIN
      scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/colorbox.scssc
  12. BIN
      scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/forms.scssc
  13. BIN
      scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/variables.scssc
  14. 4
      scss/colorbox.scss
  15. 15
      scss/forms.scss
  16. 2
      scss/variables.scss
  17. BIN
      tmp/LogoOrdineScritta.png

40
blocks/contactForm.php

@ -0,0 +1,40 @@
<form id="contact-form" method="post" action="<?php echo $BASE_URL;?>/blocks/contactFormSubmit.php">
<div class="row py-4">
<div class="col-10 col-sm-6 mx-auto">
<span class="font-12">Destinatario</span>
<select class="input" name="dest">
<option value="info@ordinefarmacistisalerno.it">Informazioni</option>
<option value="presidenza@ordinefarmacistisalerno.it">Presidenza</option>
<option value="vicepresidenza@ordinefarmacistisalerno.it">Vice Presidenza</option>
<option value="segreteria@ordinefarmacistisalerno.it">Segreteria</option>
<option value="tesoreria@ordinefarmacistisalerno.it">Tesoreria</option>
<option value="consiglio@ordinefarmacistisalerno.it">Consiglio</option>
</select>
</div>
<div class="col-sm-4 d-none d-sm-block"></div>
<div class="col-10 mx-auto">
<span class="font-12">Nome mittente</span>
<input type="text" name="name">
</div>
<div class="col-10 mx-auto">
<span class="font-12">Email mittente</span>
<input type="text" name="email">
</div>
<div class="col-10 mx-auto">
<span class="font-12">Oggetto</span>
<input type="text" name="subject">
</div>
<div class="col-10 mx-auto">
<span class="font-12">Messaggio</span>
<textarea cols="40" rows="6" name="message"></textarea>
</div>
<div class="col-10 mx-auto">
<div class="g-recaptcha" data-sitekey="6Le7kkUUAAAAAK-lsvoefiaBsH1TycWnHipCC8VF"></div>
</div>
<div class="col-10 mx-auto text-right">
<button type="submit">Invia messaggio</button>
</div>
</div>
</form>

72
blocks/contactFormSubmit.php

@ -0,0 +1,72 @@
<?php
session_start();
@include '../cgi-bin/conn.conn';
@include '../cgi-bin/functions.inc';
@include '../cgi-bin/params.inc';
$GLOBALS['getQ'][0]="home";
$GLOBALS['isHome'] = true;
$GLOBALS['conn'];
$conn=@mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb)or die("CONNECTION ERROR");
mysqli_set_charset($conn, "utf8");
?>
<!DOCTYPE html>
<html>
<head>
<title>Ordine dei Farmacisti della Provincia di Salerno</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<?php echo $BASE_URL;?>/">
<link href="<?php echo $BASE_URL;?>/css/styles.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="row no-gutters py-4">
<?php
if(sizeof($_GET)>0 && $_GET['g-recaptcha-response']){
$SM_email = $_GET['aaa'];
$SM_email2 = 0;
$SM_email_CC = 0;
$SM_subject = $_GET['subject'];
$SM_message = "Nome del mittente:". $_GET['name']."<br>";
$SM_message .= "Email del mittente:". $_GET['email']."<br><br>";
$SM_message .= $_GET['message'];
$SM_showalert = 0;
$SM_append = 0;
sendMail($SM_email,$SM_email2,$SM_email_CC,$SM_subject,$SM_message,$SM_showalert,$SM_append);
?>
<div class="col-10 text-center mx-auto">
<p><i class="fa fa-check-circle font-alert p-4"></i></p>
E-mail inviata correttamente a <?= $_GET['dest'];?>
</div>
<?php
}else{
if(sizeof($_GET)>0 &&
(!$_GET['g-recaptcha-response'] ||
strlen($_GET['name']) < 5 ||
strlen($_GET['email']) < 5 ||
strlen($_GET['message']) < 5)){
echo "<div class=\"col-10 mx-auto text-red text-center\">
<p><i class=\"fa fa-exclamation-triangle font-alert p-4\"></i></p>
ATTENZIONE: Ricorda ti compilare tutti i campi ed effettuare il controllo si sicurezza.</div>";
}
}
?>
</div>
</body>
</html>

128
cgi-bin/functions.inc

@ -1,22 +1,5 @@
<?php <?php
function conv_data($od,$lang){
$tmp=explode("-",substr($od,0,10));
switch($lang){
case "IT":
case "FR":
case "ES":
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
break;
case "DE":
$stres = $tmp[2].".".$tmp[1].".".$tmp[0]."";
break;
default:
$stres=$od;
}
return $stres;
}
function conv_date($od){ function conv_date($od){
$tmp=explode("-",substr($od,0,10)); $tmp=explode("-",substr($od,0,10));
$stres = $tmp[2]."/".$tmp[1]."/".$tmp[0].""; $stres = $tmp[2]."/".$tmp[1]."/".$tmp[0]."";
@ -24,7 +7,6 @@ function conv_date($od){
} }
function convert($stringa){ function convert($stringa){
$strres = $stringa; $strres = $stringa;
$strres = str_replace("'","&#039;",$strres); $strres = str_replace("'","&#039;",$strres);
@ -48,7 +30,6 @@ function get_filesize($path){
return filesize(realpath($_SERVER["DOCUMENT_ROOT"])."".$path); return filesize(realpath($_SERVER["DOCUMENT_ROOT"])."".$path);
} }
function save_photo($foto,$basepath,$id){ function save_photo($foto,$basepath,$id){
$filename = $foto; $filename = $foto;
@ -90,13 +71,7 @@ function save_photo($foto,$basepath,$id){
function item_file($file){ function item_file($file){
@include 'params.inc'; @include 'params.inc';
/*
$size = get_filesize($file['path']."/".$file['filename']);
if($size > 1000){$size = ($size/1000)."Mb";}else{$size = $size."Kb";}
date("d/m/Y", filemtime($file['path']."/".$file['filename']))
*/
echo "<div class=\"item\"><a href=\"".$BASE_URL."".$file['path']."/".$file['filename']."\" target=\"_blank\"><div class=\" row\"> echo "<div class=\"item\"><a href=\"".$BASE_URL."".$file['path']."/".$file['filename']."\" target=\"_blank\"><div class=\" row\">
<div class=\"title col-6 col-sm-8\">".$file['title']."</div> <div class=\"title col-6 col-sm-8\">".$file['title']."</div>
<div class=\"size col-2\">".$file['size']."</div> <div class=\"size col-2\">".$file['size']."</div>
@ -106,4 +81,107 @@ function item_file($file){
function sendMail($SM_email,$SM_email2,$SM_email_CC,$SM_subject,$SM_message,$SM_showalert,$SM_append){
$host=$GLOBALS['BASE_URL']."";
$send_date=conv_date(date("Y-m-d"));
$top=<<<ttop
<html><head><style>
body{font-family: sans, Arial; margin: 0px; font-size: 10pt;}
td{font-family: sans-serif; font-size: 10pt;}
</style></head><body bgcolor="#FFFFFF"><center>
<table border="0" width="720" cellspadding="20">
<tr><td align="center" colspan="2">
<img src="$host/images/logo.png" alt="Ordine dei Farmacisti di Salerno" width="150"><br><br></td></tr>
<tr><td align="left" style="padding:5px;" ><b>$SM_subject</b></td>
<td align="right" style="padding:5px;" >$send_date</td></tr>
<tr><td style="border-top: 8px solid #4e984a;border-left: 1px solid #4e984a;border-right: 1px solid #4e984a;border-bottom: 8px solid #4e984a;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px; padding:10px;line-height:23px" bgcolor="#fff" colspan="2">
ttop;
$bottom="</td></tr>";
$bottom.="<tr><td colspan=\"2\" align=\"center\" style=\"text-align:justify; font-size:8pt\"><br>".
"Questa e-mail contiene informazioni di propriet&agrave; e di natura confidenziale. Se non siete il destinatario corretto di questo messaggio, vi ricordiamo che ogni diffusione, distribuzione o copia di questo messaggio &egrave; severamente proibita. Se avete ricevuto questo messaggio per errore, siete pregati di cancellarlo immediatamente. Quanto precede ai fini del rispetto del D.L. n. 196/03 sulla tutela dei dati personali.<br>-<br>".
"This e-mail (and any attachments) is strictly confidential and for use only by intendend recipients. If you are not an intended recipients, we point you that any diffusion, distribution or copy of this message is severely forbidden. If you have received t his message by mistake please destroy it immediately (under the observance of D.L. n. 196/03 which protects personal data).".
"<br>Rispetta l'ambiente. Non stampare questa mail se non &egrave; necessaria.";
$bottom.="</td></tr></table></center></body></html>";
$headers = "From: \"Ordine dei Farmacisti di Salerno\" <info@ordinefarmacistisalerno.itt> \n";
$headers .= "MIME-Version: 1.0\n";
$msg="";
if($SM_append){
$append_name = basename($SM_append);
$append_type = mime_content_type($SM_append);
$data = chunk_split(base64_encode(file_get_contents($SM_append)));
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "Content-Type: multipart/mixed;\n";
$headers .= " boundary=\"{$mime_boundary}\"\n";
$headers .= "X-Mailer: PHP " . phpversion();
$msg .= "This is a multi-part message in MIME format.\n\n";
$msg .= "--{$mime_boundary}\n";
$msg .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg .= "Content-Transfer-Encoding: 7bit\n\n";
$msg .= $top.$SM_message.$bottom."\n\n";
$msg .= "--{$mime_boundary}\n";
$msg .= "Content-Type: {$append_type}; name=\"{$append_name}\"\n";
$msg .= "Content-Transfer-Encoding: base64\n";
$msg .= "Content-Disposition: attachment; filename=\"{$append_name}\"\n\n";
$msg .= $data."\n\n";
$msg .= "--{$mime_boundary}--\n";
}else{
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$msg = $top.$SM_message.$bottom."\n\n";
}
if(@mail(trim($SM_email),$SM_subject,$msg, $headers)){
if(@$SM_email2){
if($SM_email_CC){
$headers = "Bcc: $SM_email_CC \n".$headers;
}
@mail(trim($SM_email2),$SM_subject,$msg, $headers)or die("errore invio mail");
}
if($SM_showalert){
echo "<br><center><h1><i class=\"fa fa-check\"></i></h1><h2>E-mail inviata correttamente</h2><br></center>";
}
}else{
if($SM_showalert){
echo "<br><br><br><center><h1><i class=\"fa fa-exclamation-triangle\"></i></h1><h2>ERRORE:</h2><br>".
"Si &egrave; verificato un errore nell'invio della mail.<br>".
"Si prega contattare l'amministratore del sistema.</center>";
}
}
/*
$of=fopen("../mailoutput.html","w");
fwrite($of, "Email:".$SM_email."\n<br>Email:".$SM_email2."\n<br>Email CC:".$SM_email_CC."\n<br>Subject:".$SM_subject."\n<br><br>CONTENT:\n".$msg);
fclose($of);
*/
}
?> ?>

34
contatti.php

@ -0,0 +1,34 @@
<div class="row">
<div class="col-12">
<div class="section-title">Contatti</div>
</div>
<div class="col-12 contacts">
<i class="fa fa-map-marker"></i> <b>Sede:</b> Via Settimio Mobilio, 17 - SALERNO<br>
<i class="fa fa-phone"></i> <b>Telefono:</b> 089.405080 - 089.795900<br>
<i class="fa fa-fax"></i> <b>Fax:</b> 089.798628<br>
<i class="fa fa-envelope"></i> <b>E-Mail:</b> info@ordinefarmacistisalerno.it<br>
<i class="fa fa-envelope"></i> <b>E-Mail certificata:</b> ordinefarmacistisa@pec.fofi.it <br>
</div>
<div class="col-12">
<div class="section-title">Richiedi informazioni</div>
</div>
<div class="col-12">
<?php
@include 'blocks/contactForm.php';
?>
</div>
<div class="col-12">
<div class="section-title">Come raggiungerci</div>
</div>
<div class="col-12">
<div id="map" class="px-0">
<iframe width="100%" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.it/maps?f=q&amp;source=s_q&amp;hl=it&amp;geocode=&amp;q=ordine+farmacisti+salerno&amp;sll=41.442726,12.392578&amp;sspn=17.04957,43.286133&amp;ie=UTF8&amp;hq=ordine+farmacisti&amp;hnear=Salerno+SA&amp;ll=40.685389,14.781933&amp;spn=0.004012,0.014656&amp;z=14&amp;iwloc=A&amp;cid=4099829483191197382&amp;output=embed"></iframe>
</div>
</div>
</div>

62
css/styles.css

@ -104,7 +104,7 @@
/* line 68, variables.scss */ /* line 68, variables.scss */
.font-alert { .font-alert {
font-size: 8rem;
font-size: 8rem !important;
opacity: .5; opacity: .5;
} }
@ -14184,7 +14184,13 @@ a.text-dark:hover, a.text-dark:focus {
color: black; color: black;
} }
/* line 143, colorbox.scss */
/* line 142, colorbox.scss */
#cboxClose {
background: white;
border-radius: 0 0 0 10px;
}
/* line 147, colorbox.scss */
.cboxIE #cboxTopLeft, .cboxIE #cboxTopLeft,
.cboxIE #cboxTopCenter, .cboxIE #cboxTopCenter,
.cboxIE #cboxTopRight, .cboxIE #cboxTopRight,
@ -14389,38 +14395,51 @@ a:hover {
} }
/* line 3, forms.scss */ /* line 3, forms.scss */
input, select, button {
input,
select,
button,
textarea {
border-radius: 3px; border-radius: 3px;
margin: 5px 0; margin: 5px 0;
-webkit-appearance: none; -webkit-appearance: none;
outline: none !important; outline: none !important;
} }
/* line 7, forms.scss */
input::-ms-clear, select::-ms-clear, button::-ms-clear {
/* line 10, forms.scss */
input::-ms-clear,
select::-ms-clear,
button::-ms-clear,
textarea::-ms-clear {
display: none; display: none;
} }
/* line 10, forms.scss */
input:focus, select:focus, button:focus {
/* line 13, forms.scss */
input:focus,
select:focus,
button:focus,
textarea:focus {
outline: none; outline: none;
} }
/* line 11, forms.scss */
input::-moz-focus-inner, select::-moz-focus-inner, button::-moz-focus-inner {
/* line 14, forms.scss */
input::-moz-focus-inner,
select::-moz-focus-inner,
button::-moz-focus-inner,
textarea::-moz-focus-inner {
border: 0; border: 0;
} }
/* line 16, forms.scss */
/* line 19, forms.scss */
input[type=text], input[type=text],
input[type=password], input[type=password],
select {
select,
textarea {
border: 1px solid #aaa; border: 1px solid #aaa;
color: #aaa; color: #aaa;
padding: 5px 20px;
padding: 5px 10px;
width: 100%; width: 100%;
text-align: left; text-align: left;
box-sizing: border-box; box-sizing: border-box;
} }
/* line 27, forms.scss */
/* line 31, forms.scss */
input[type=button], input[type=button],
input[type=submit], input[type=submit],
button { button {
@ -14434,7 +14453,14 @@ button {
border: none; border: none;
transition: .5s; transition: .5s;
} }
/* line 41, forms.scss */
/* line 45, forms.scss */
input[type=button]:disabled,
input[type=submit]:disabled,
button:disabled {
color: white;
background-color: #aaa;
}
/* line 50, forms.scss */
input[type=button]:hover, input[type=button]:hover,
input[type=submit]:hover, input[type=submit]:hover,
button:hover { button:hover {
@ -14442,7 +14468,7 @@ button:hover {
background-color: #aaa; background-color: #aaa;
} }
/* line 49, forms.scss */
/* line 58, forms.scss */
select { select {
appearance: none; appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -14454,12 +14480,12 @@ select {
background-repeat: no-repeat; background-repeat: no-repeat;
} }
/* line 61, forms.scss */
/* line 70, forms.scss */
input[type="radio"], input[type="radio"],
input[type="checkbox"] { input[type="checkbox"] {
display: none; display: none;
} }
/* line 65, forms.scss */
/* line 74, forms.scss */
input[type="radio"] + label::before, input[type="radio"] + label::before,
input[type="checkbox"] + label::before { input[type="checkbox"] + label::before {
content: ""; content: "";
@ -14474,7 +14500,7 @@ input[type="checkbox"] + label::before {
font-size: 1rem; font-size: 1rem;
line-height: 10px; line-height: 10px;
} }
/* line 80, forms.scss */
/* line 89, forms.scss */
input[type="radio"]:checked + label::before, input[type="radio"]:checked + label::before,
input[type="checkbox"]:checked + label::before { input[type="checkbox"]:checked + label::before {
font-family: 'FontAwesome'; font-family: 'FontAwesome';

4
farmacie.php

@ -1,7 +1,3 @@
<?php
?>
<div class="row pharmacy"> <div class="row pharmacy">

BIN
images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

2
index.php

@ -92,6 +92,8 @@
<script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/jquery/dist/jquery.min.js"></script> <script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/jquery-colorbox/jquery.colorbox-min.js"></script> <script type="text/javascript" src="<?php echo $BASE_URL;?>/node_modules/jquery-colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></script>
<script type="text/javascript" src="<?php echo $BASE_URL;?>/js/scripts.js"></script> <script type="text/javascript" src="<?php echo $BASE_URL;?>/js/scripts.js"></script>

8
js/scripts.js

@ -2,8 +2,11 @@
$(document).ready(function(){ $(document).ready(function(){
$('.cboxElement').colorbox({height: '80%',transition: 'elastic'});
$('.cboxElement').colorbox({height: '80%',transition: 'elastic', close: ''});
$('#contact-form').on('submit', function(event) {
$.colorbox({width:"60%", height:"60%",transition: 'elastic', close: '', iframe: true, href:$(this).attr('action')+"?" + $(this).serialize()});
event.preventDefault();
});
var isHome = $('body').hasClass('is-home'); var isHome = $('body').hasClass('is-home');
@ -50,4 +53,5 @@ $(document).ready(function(){
}); });
}); });

4
parafarmacie.php

@ -1,7 +1,3 @@
<?php
?>
<div class="row pharmacy"> <div class="row pharmacy">

BIN
scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/colorbox.scssc

Binary file not shown.

BIN
scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/forms.scssc

Binary file not shown.

BIN
scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/variables.scssc

Binary file not shown.

4
scss/colorbox.scss

@ -139,6 +139,10 @@
} }
#cboxClose{
background: white;
border-radius: 0 0 0 10px;
}
.cboxIE #cboxTopLeft, .cboxIE #cboxTopLeft,
.cboxIE #cboxTopCenter, .cboxIE #cboxTopCenter,

15
scss/forms.scss

@ -1,6 +1,9 @@
input,select,button{
input,
select,
button,
textarea{
border-radius: 3px; border-radius: 3px;
margin: 5px 0; margin: 5px 0;
-webkit-appearance: none; -webkit-appearance: none;
@ -15,10 +18,11 @@ input,select,button{
input[type=text], input[type=text],
input[type=password], input[type=password],
select{
select,
textarea{
border: 1px solid $grey; border: 1px solid $grey;
color: $grey; color: $grey;
padding: 5px 20px;
padding: 5px 10px;
width: 100%; width: 100%;
text-align: left; text-align: left;
box-sizing: border-box; box-sizing: border-box;
@ -38,6 +42,11 @@ button{
border: none; border: none;
transition: .5s; transition: .5s;
&:disabled{
color: white;
background-color: $grey;
}
&:hover{ &:hover{
color: white; color: white;
background-color: $grey; background-color: $grey;

2
scss/variables.scss

@ -66,7 +66,7 @@ $font-alert: 8rem; /* ?px */
.font-#{$size} {font-size: #{$size/16}rem !important;} .font-#{$size} {font-size: #{$size/16}rem !important;}
} }
.font-alert{ .font-alert{
font-size: 8rem;
font-size: $font-alert !important;
opacity: .5; opacity: .5;
} }

BIN
tmp/LogoOrdineScritta.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Loading…
Cancel
Save