update homepage, remove contact form

This commit is contained in:
Ben Harris 2018-11-02 14:50:03 -04:00
parent 00a70987e2
commit 2455c9fba4
4 changed files with 13 additions and 198 deletions

View File

@ -1,74 +0,0 @@
<?php
// Replace this with your own email address
$siteOwnersEmail = 'benharri@pm.me';
if ($_POST) {
$name = trim(stripslashes($_POST['contactName']));
$email = trim(stripslashes($_POST['contactEmail']));
$subject = trim(stripslashes($_POST['contactSubject']));
$contact_message = trim(stripslashes($_POST['contactMessage']));
// Check Name
$error = [];
if (strlen($name) < 2) {
$error['name'] = "Please enter your name.";
}
// Check Email
if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {
$error['email'] = "Please enter a valid email address.";
}
// Check Message
if (strlen($contact_message) < 15) {
$error['message'] = "Please enter your message. It should have at least 15 characters.";
}
// Subject
if ($subject == '') {
$subject = "benharr.is message from $name";
} else {
$subject = "benharr.is message from $name: $subject";
}
// Set Message
$message .= "Email from: " . $name . "<br />";
$message .= "Email address: " . $email . "<br />";
$message .= "Message: <br /><pre>";
$message .= $contact_message;
$message .= "</pre><br /> ----- <br /> This email was sent from your site's contact form. <br />";
// Set From: header
$from = $name . " <" . $email . ">";
// Email Headers
$headers = "From: admin<admin@gingko>\r\n";
$headers .= "Reply-To: ". $email . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if (count($error) == 0) {
ini_set("sendmail_from", $siteOwnersEmail); // for windows server
$mail = mail($siteOwnersEmail, $subject, $message, $headers);
if ($mail) {
echo "OK";
} else {
echo "Something went wrong. Please try again.";
}
} else {
$response = (isset($error['name'])) ? $error['name'] . "<br /> \n" : null;
$response .= (isset($error['email'])) ? $error['email'] . "<br /> \n" : null;
$response .= (isset($error['message'])) ? $error['message'] . "<br />" : null;
echo $response;
} # end if - there was a validation error
}

View File

@ -72,6 +72,10 @@ include 'header.php';
travel and have lived in Ecuador and Switzerland.
</p>
<p>
I run a public access unix system: <a href="https://tilde.team">tilde.team</a> and have been working on a multi-tilde collaborative effort to provide cool open-source services at the <a href="https://tildeverse.org">tildeverse</a>. Check out <a href="https://tilde.team/~ben/">my tilde page</a>!
</p>
<p>Check out what I'm up to
<a href="/now">now</a>.</p>
@ -237,11 +241,11 @@ include 'header.php';
<h3>Iron Fish Distillery</h3>
<p class="info">App Developer/Webmaster
<span>&bull;</span>
<em class="date">June 2016 - Present</em>
<em class="date">June 2016 - June 2018</em>
</p>
<p>
Build and maintain several web applications for internal use. Also in charge of maintenance of the current Wordpress site.
Build and maintain several web applications for internal use. Also in charge of maintenance of the Wordpress site.
</p>
</div>
@ -342,80 +346,15 @@ include 'header.php';
<div class="ten columns">
<p class="lead">Let me know if you have any cool ideas or want to work together on something! Feel free to send me a message
on
<a href="https://t.me/bharris">Telegram</a> or send me an email with this form here.</p>
<p class="lead">
Let me know if you have any cool ideas or want to work together on something! Feel free to send me a message on irc (benharri on freenode, ben on <a href="https://tilde.chat">tilde.chat</a>) or shoot me an email (ben at this domain).
</p>
</div>
</div>
<div class="row">
<div class="eight columns">
<!-- form -->
<form action="" method="post" id="contactForm" name="contactForm">
<fieldset>
<div>
<label for="contactName">Name
<span class="required">*</span>
</label>
<input type="text" value="" size="35" id="contactName" name="contactName">
</div>
<div>
<label for="contactEmail">Email
<span class="required">*</span>
</label>
<input type="text" value="" size="35" id="contactEmail" name="contactEmail">
</div>
<div>
<label for="contactSubject">Subject</label>
<input type="text" value="" size="35" id="contactSubject" name="contactSubject">
</div>
<div>
<label for="contactMessage">Message
<span class="required">*</span>
</label>
<textarea cols="50" rows="15" id="contactMessage" name="contactMessage"></textarea>
</div>
<div>
<button class="submit">Submit</button>
<span id="image-loader">
<img alt="" src="images/loader.gif">
</span>
</div>
</fieldset>
</form>
<!-- Form End -->
<!-- contact-warning -->
<div id="message-warning"> Error boy</div>
<!-- contact-success -->
<div id="message-success">
<i class="fa fa-check"></i>Your message was sent, thank you!
<br>
</div>
</div>
<aside class="four columns footer-widgets">
<div class="widget widget_contact">
<h4>Hi!</h4>
<p>I look forward to hearing from you!</p>
</div>
</aside>
</div>

View File

@ -133,56 +133,5 @@
randomize: false,
});
/*----------------------------------------------------*/
/* contact form
------------------------------------------------------*/
$('form#contactForm button.submit').click(function() {
$('#image-loader').fadeIn();
var contactName = $('#contactForm #contactName').val();
var contactEmail = $('#contactForm #contactEmail').val();
var contactSubject = $('#contactForm #contactSubject').val();
var contactMessage = $('#contactForm #contactMessage').val();
var data = 'contactName=' + contactName + '&contactEmail=' + contactEmail +
'&contactSubject=' + contactSubject + '&contactMessage=' + contactMessage;
console.log(data);
$.ajax({
type: "POST",
url: "inc/sendEmail.php",
data: data,
success: function(msg) {
console.log(msg);
// Message was sent
if (msg == 'OK') {
$('#image-loader').fadeOut();
$('#message-warning').hide();
$('#contactForm').fadeOut();
$('#message-success').fadeIn();
}
// There was an error
else {
$('#image-loader').fadeOut();
$('#message-warning').html(msg);
$('#message-warning').fadeIn();
}
}
});
return false;
});
});

View File

@ -55,12 +55,13 @@ include __DIR__."/../header.php";
<li>&bull; Learning C# and practicing Ruby</li>
<li>&bull; <del>Flying Drones</del> (cold isn't good for battery life, hopefully picking this back up once it's warmer out:)</li>
<li>&bull; Thinking of cool ideas for <a href="https://tilde.team">tilde.team</a></li>
<li>&bull; We have a <a href="https://tilde.team/discord/">Discord server</a> now!</li>
<li>&bull; Probably spending too much time on irc??? <a href="https://tilde.team/irc/">tilde-irc</a></li>
<li>&bull; Probably spending too much time on irc??? <a href="https://tilde.chat/">tilde-irc</a></li>
<li>&bull; Running stuff for the <a href="https://tildeverse.org/">tildeverse</a></li>
<li>&bull; Starting <a href="https://tilderadio.org/">tilderadio</a>, an internet radio station for the tildeverse</li>
<li>&bull; Looking for open source projects to contribute to. <a href="mailto:ben@tilde.team">Hit me up</a> if you have any ideas or suggestions.</li>
</ul>
<p>Updated April 10th, 2018</p>
<p>Updated November 2nd, 2018</p>
</div> <!-- end .main-col -->