Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nikooo777 committed May 21, 2018
0 parents commit 48b50e7
Show file tree
Hide file tree
Showing 78 changed files with 32,441 additions and 0 deletions.
114 changes: 114 additions & 0 deletions contactform/contactform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
jQuery(document).ready(function($) {
"use strict";

//Contact
$('form.contactForm').submit(function() {
var f = $(this).find('.form-group'),
ferror = false,
emailExp = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;

f.children('input').each(function() { // run all inputs

var i = $(this); // current input
var rule = i.attr('data-rule');

if (rule !== undefined) {
var ierror = false; // error flag for current input
var pos = rule.indexOf(':', 0);
if (pos >= 0) {
var exp = rule.substr(pos + 1, rule.length);
rule = rule.substr(0, pos);
} else {
rule = rule.substr(pos + 1, rule.length);
}

switch (rule) {
case 'required':
if (i.val() === '') {
ferror = ierror = true;
}
break;

case 'minlen':
if (i.val().length < parseInt(exp)) {
ferror = ierror = true;
}
break;

case 'email':
if (!emailExp.test(i.val())) {
ferror = ierror = true;
}
break;

case 'checked':
if (! i.is(':checked')) {
ferror = ierror = true;
}
break;

case 'regexp':
exp = new RegExp(exp);
if (!exp.test(i.val())) {
ferror = ierror = true;
}
break;
}
i.next('.validation').html((ierror ? (i.attr('data-msg') !== undefined ? i.attr('data-msg') : 'wrong Input') : '')).show('blind');
}
});
f.children('textarea').each(function() { // run all inputs

var i = $(this); // current input
var rule = i.attr('data-rule');

if (rule !== undefined) {
var ierror = false; // error flag for current input
var pos = rule.indexOf(':', 0);
if (pos >= 0) {
var exp = rule.substr(pos + 1, rule.length);
rule = rule.substr(0, pos);
} else {
rule = rule.substr(pos + 1, rule.length);
}

switch (rule) {
case 'required':
if (i.val() === '') {
ferror = ierror = true;
}
break;

case 'minlen':
if (i.val().length < parseInt(exp)) {
ferror = ierror = true;
}
break;
}
i.next('.validation').html((ierror ? (i.attr('data-msg') != undefined ? i.attr('data-msg') : 'wrong Input') : '')).show('blind');
}
});
if (ferror) return false;
else var str = $(this).serialize();
$.ajax({
type: "POST",
url: "contactform/contactform.php",
data: str,
success: function(msg) {
// alert(msg);
if (msg == 'OK') {
$("#sendmessage").addClass("show");
$("#errormessage").removeClass("show");
$('.contactForm').find("input, textarea").val("");
} else {
$("#sendmessage").removeClass("show");
$("#errormessage").addClass("show");
$('#errormessage').html(msg);
}

}
});
return false;
});

});
72 changes: 72 additions & 0 deletions contactform/contactform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/*
PHP contact form script
Copyrights BootstrapMade.com
*/

/***************** Configuration *****************/

// Enter your email, where you want to receive the messages.
$contact_email_to = "hello@lbry.io";

// Subject prefix
$contact_subject_prefix = "Contact Form Message: ";

// Name too short error text
$contact_error_name = "Name is too short or empty!";

// Email invalid error text
$contact_error_email = "Please enter a valid email!";

// Subject too short error text
$contact_error_subject = "Subject is too short or empty!";

// Message too short error text
$contact_error_message = "Too short message! Please enter something.";

/********** Do not edit from the below line ***********/

if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') {
die('Sorry Request must be Ajax POST');
}

if(isset($_POST)) {

$name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
$subject = filter_var($_POST["subject"], FILTER_SANITIZE_STRING);
$message = filter_var($_POST["message"], FILTER_SANITIZE_STRING);

if(strlen($name)<4){
die($contact_error_name);
}

if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
die($contact_error_email);
}

if(strlen($message)<3){
die($contact_error_subject);
}

if(strlen($message)<3){
die($contact_error_message);
}

if(!isset($contact_email_from)) {
$contact_email_from = "submissions@" . @preg_replace('/^www\./','', $_SERVER['SERVER_NAME']);
}

$sendemail = mail($contact_email_to, $contact_subject_prefix . $subject, $message,
"From: $name <$contact_email_from>" . PHP_EOL .
"Reply-To: $email" . PHP_EOL .
"X-Mailer: PHP/" . phpversion()
);

if( $sendemail ) {
echo 'OK';
} else {
echo 'Could not send mail! Please check your PHP mail configuration.';
}
}
?>
32 changes: 32 additions & 0 deletions css/_footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// main: style.scss
/*--------------------------------------------------------------
# Footer
--------------------------------------------------------------*/
#footer {
background: #fff;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.1);
padding: 30px 0;
color: #333;
font-size: 14px;

.copyright {
}

.credits {
font-size: 13px;
color: #888;
}

.footer-links {
a {
color: #666;
padding-left: 15px;
&:first-child {
padding-left: 0;
}
&:hover {
color: $accent-color;
}
}
}
}
58 changes: 58 additions & 0 deletions css/_general.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// main: style.scss
/*--------------------------------------------------------------
# General
--------------------------------------------------------------*/
body {
background: #fff;
color: $text-color;
font-family: $text-font;
overflow-x: hidden;
}

a {
color: $accent-color;
transition: 0.5s;
}

a:hover, a:active, a:focus {
color: lighten($accent-color, 0.2%);
outline: none;
text-decoration: none;
}

p {
padding: 0;
margin: 0 0 30px 0;
}

h1, h2, h3, h4, h5, h6 {
font-family: $heading-font;
font-weight: 400;
margin: 0 0 20px 0;
padding: 0;
}

/* Back to top button */
.back-to-top {
position: fixed;
display: none;
background: linear-gradient(45deg, #1de099, #1dc8cd);
color: #fff;
padding: 2px 20px 8px 20px;
font-size: 16px;
border-radius: 4px 4px 0 0;
right:15px;
bottom: 0;
transition: none;

&:focus {
background: linear-gradient(45deg, #1de099, #1dc8cd);
color: #fff;
outline: none;
}

&:hover {
background: $accent_color;
color: #fff;
}
}
Loading

0 comments on commit 48b50e7

Please sign in to comment.