Skip to content

Commit 3e1c560

Browse files
committed
Initial Commit
0 parents  commit 3e1c560

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+9268
-0
lines changed

contact.php

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?php
2+
/**
3+
* EDIT THE VALUES BELOW THIS LINE TO ADJUST THE CONFIGURATION
4+
* EACH OPTION HAS A COMMENT ABOVE IT WITH A DESCRIPTION
5+
*/
6+
/**
7+
* Specify the email address to which all mail messages are sent.
8+
* The script will try to use PHP's mail() function,
9+
* so if it is not properly configured it will fail silently (no error).
10+
*/
11+
$mailTo = '[email protected]';
12+
13+
/**
14+
* Set the message that will be shown on success
15+
*/
16+
$successMsg = 'Thank you, mail sent successfuly!';
17+
18+
/**
19+
* Set the message that will be shown if not all fields are filled
20+
*/
21+
$fillMsg = 'Please fill all fields!';
22+
23+
/**
24+
* Set the message that will be shown on error
25+
*/
26+
$errorMsg = 'Hm.. seems there is a problem, sorry!';
27+
28+
/**
29+
* DO NOT EDIT ANYTHING BELOW THIS LINE, UNLESS YOU'RE SURE WHAT YOU'RE DOING
30+
*/
31+
32+
?>
33+
<?php
34+
if(
35+
!isset($_POST['contact-name']) ||
36+
!isset($_POST['contact-email']) ||
37+
!isset($_POST['contact-phone']) ||
38+
!isset($_POST['contact-subject']) ||
39+
!isset($_POST['contact-message']) ||
40+
empty($_POST['contact-name']) ||
41+
empty($_POST['contact-email']) ||
42+
empty($_POST['contact-phone']) ||
43+
empty($_POST['contact-subject']) ||
44+
empty($_POST['contact-message'])
45+
) {
46+
47+
if( empty($_POST['contact-name']) && empty($_POST['contact-email']) && empty($_POST['contact-phone']) && empty($_POST['contact-subject']) && empty($_POST['contact-message']) ) {
48+
$json_arr = array( "type" => "error", "msg" => $fillMsg );
49+
echo json_encode( $json_arr );
50+
} else {
51+
52+
$fields = "";
53+
if( !isset( $_POST['contact-name'] ) || empty( $_POST['contact-name'] ) ) {
54+
$fields .= "Name";
55+
}
56+
57+
if( !isset( $_POST['contact-email'] ) || empty( $_POST['contact-email'] ) ) {
58+
if( $fields == "" ) {
59+
$fields .= "Email";
60+
} else {
61+
$fields .= ", Email";
62+
}
63+
}
64+
65+
if( !isset( $_POST['contact-phone'] ) || empty( $_POST['contact-phone'] ) ) {
66+
if( $fields == "" ) {
67+
$fields .= "Phone";
68+
} else {
69+
$fields .= ", Phone";
70+
}
71+
}
72+
73+
if( !isset( $_POST['contact-subject'] ) || empty( $_POST['contact-subject'] ) ) {
74+
if( $fields == "" ) {
75+
$fields .= "Subject";
76+
} else {
77+
$fields .= ", Subject";
78+
}
79+
}
80+
81+
if( !isset( $_POST['contact-message'] ) || empty( $_POST['contact-message'] ) ) {
82+
if( $fields == "" ) {
83+
$fields .= "Message";
84+
} else {
85+
$fields .= ", Message";
86+
}
87+
}
88+
$json_arr = array( "type" => "error", "msg" => "Please fill ".$fields." fields!" );
89+
echo json_encode( $json_arr );
90+
91+
}
92+
93+
94+
} else {
95+
96+
// Validate e-mail
97+
if (!filter_var($_POST['contact-email'], FILTER_VALIDATE_EMAIL) === false) {
98+
99+
$msg = "Name: ".$_POST['contact-name']."\r\n";
100+
$msg .= "Email: ".$_POST['contact-email']."\r\n";
101+
$msg .= "Phone: ".$_POST['contact-phone']."\r\n";
102+
$msg .= "Subject: ".$_POST['contact-subject']."\r\n";
103+
$msg .= "Message: ".$_POST['contact-message']."\r\n";
104+
105+
$success = @mail($mailTo, $_POST['contact-email'], $msg, 'From: ' . $_POST['contact-name'] . '<' . $_POST['contact-email'] . '>');
106+
107+
if ($success) {
108+
$json_arr = array( "type" => "success", "msg" => $successMsg );
109+
echo json_encode( $json_arr );
110+
} else {
111+
$json_arr = array( "type" => "error", "msg" => $errorMsg );
112+
echo json_encode( $json_arr );
113+
}
114+
115+
} else {
116+
$json_arr = array( "type" => "error", "msg" => "Please enter valid email address!" );
117+
echo json_encode( $json_arr );
118+
}
119+
120+
}

css/custom.css

Lines changed: 220 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/custom.css.map

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)