So, I built an online portfolio for myself, and
Posted: Mon Sep 25, 2006 11:46 pm
I'd like to know what you all think. Please tear it apart, and tell me what sucks, or if it's good, please stroke my ego 
http://portfolio.nvdesign.net
Since this forum is more towards php code, I'd like to post the backend to the site (so very small and simple, but since there's an email form i'd like to get it checked over
)
index.php
pagetop.inc.php
email.php
I won't bother posting portfolio.php as it simply echo's the list of sites stored in an array...
I know it's simple, it's just always good to have a second (or third, or fourth, or ... N) pair of eyes.
Tnx
http://portfolio.nvdesign.net
Since this forum is more towards php code, I'd like to post the backend to the site (so very small and simple, but since there's an email form i'd like to get it checked over
index.php
Code: Select all
<?php require_once('inc/pagetop.inc.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="A Gallery of Designs by Web Developer Nick Van Dorsten" />
<meta name="keywords" content="web design, portfolio, development, design, html, xhtml, standards compliant, css, web application, ajax, web 2.0" />
<meta name="author" content="Nick Van Dorsten" />
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
<script type="text/javascript" src="inc/jquery.js"></script>
<script type="text/javascript" src="inc/interface.js"></script>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
<?php if ($success==true): ?>
$('#formSuccess').hide().ScrollTo(1500,'easeboth').BlindDown(1000,null,'bounceout');
setTimeout(function(){$('#formSuccess').Fold(1000,20,null,'bounceout');},4500);
<?php elseif (isset($errors)): ?>
$('#formError').hide().ScrollTo(1500,'easeboth').BlindDown(1000,null,'bounceout');
<?php endif; ?>
});
//]]></script>
<title>Nick Van Dorsten, Web Design Portfolio</title>
</head>
<body>
<div id="bodyWrapper">
<div id="header">
<h1>Web Design Portfolio</h1>
<div>of</div>
<h2><a href="mailto:nickvd@gmail.com">Nick Van Dorsten</a></h2>
</div>
<p>Outlined below, is a list of many of the websites that I have designed and developed for clients around the world. Some of the sites are still under development, and as a result only a screenshot can be provided. However, the sites that are complete and live can be visited by using the link that is provided under the thumbnail.</p>
<p>I pride myself in designing websites which are standards compliant and as cross-browser as possible, while still maintaining ease of maintenence and a pleasing design. I've also been programming in PHP, JavaScript and mySql for over 5 years, having designed and built many custom web applications for clients, including content management/editing systems, easy news posting scripts, a business contact listing directory, and a custom coupon generator.</p>
<div id="portfolio">
<ul><?php include_once('inc/portfolio.php'); ?></ul>
<div class="clr"></div>
</div>
<div id="contactInfo">
<?php if (isset($formResult)) echo $formResult; ?>
Nick Van Dorsten,<br/>
Web Application Developer<br/>
email: <a href="mailto:nickvd@gmail.com">nickvd@gmail.com</a><br/>
Please Use This Contact Form If You Have Any Questions:
<form action="index.php" method="post">
<fieldset id="contactForm">
<legend>Email Me</legend>
<div><label for="name">Name:</label><input type="text" name="name" id="name" value="<?php echo $name; ?>"/><br/></div><br/>
<div><label for="email">Email:</label><input type="text" name="email" id="email" value="<?php echo $email; ?>"/><br/></div><br/>
<div><label for="message">Message:</label><textarea name="message" id="message" cols="30" rows="5"><?php echo $msg; ?></textarea><br/></div><br/>
<div><input type="submit" name="submit" id="submit" value="Send Email" /></div><br/>
</fieldset>
</form>
</div>
</div>
<div id="footer">Copyright, 2006 Nick Van Dorsten • <a href="http://validator.w3.org/check?uri=referer"><img src="images/xhtml11.png" alt="Valid XHTML"/></a> • <a href="http://jigsaw.w3.org/css-validator/"><img src="images/css.gif" alt="Valid CSS"/></a></div>
</body>
</html>Code: Select all
<?php
error_reporting(0);
define('TURNED_ON',true); //do we send emails?
define('CELL',true); // do we send them to my cell phone?
$name = $email = $msg = $success = $errors = $formResult = '';
if (!empty($_POST)) {
require_once('inc/email.php');
if (!empty($_POST['name'])) $name = preg_replace('/[^a-zA-Z\-_\' ]+/','',$_POST['name']);
else $errors[] = "Name Empty or Invalid...";
if (!empty($_POST['email']) && preg_match('/^[a-z0-9]+[\w\-_\.]*?[a-z0-9]@[a-z0-9]+[a-z0-9\-\.]*' . '\.(?:com|uk|us|info|biz|gov|net|org|edu|ac|au|ca|de|eu|it|ro|ru|th)$/i',$_POST['email']))
$email = $_POST['email'];
else $errors[] = "Email Invalid Please Re-Enter...";
if (!empty($_POST['message'])) $msg = strip_tags(trim($_POST['message']));
else $errors[] = "No Message Supplied, Please Don't Send Blank Messages...";
//no errors in input, try to send the mail
if (!is_array($errors)) {
$success = sendMail($name,$email,$msg);
if (!$success) $errors[] = "We Are Currently Experiencing Network Difficulties, Please Try Again In A Few Minutes...";
}
//prep success/error message for user
if (is_array($errors)) {
$formResult = "
<div id='formError'><div>
<h1>There Were Errors In Your Form Submission</h1>
<h3>Please See Below...</h3>
<ul><li>".implode('</li><li>',$errors)."</li></ul>
</div></div>";
} elseif ($success === true) {
$formResult = "<div id='formSuccess'><div><h1>Your Message<br/>Was Sent Successfully...</h1></div></div>";
}
}
?>Code: Select all
<?php
function sendMail($name,$email,$message) {
if (!TURNED_ON) return true;
require_once('Swift.php');
require_once('Swift/Connection/SMTP.php');
$error = false;
$swift = new Swift(new Swift_Connection_SMTP('smtp.gmail.com', SWIFT_SECURE_PORT, SWIFT_TLS));
$swift->authenticate();
if (!$swift->hasFailed()) {
$swift->send(
'nickvd@gmail.com',
'portfolio@nvdesign.net',
'From Portfolio',
"name: {$name}\nemail: {$email}\nmessage: {$message}"
);
if ($swift->hasFailed()) $error = true;
if (!CELL) {$swift->close();return !$error;}
$swift->send(
'my_cell_phone_addy',
'portfolio@nvdesign.net',
'From Portfolio',
"name: {$name}\nemail: {$email}"
);
$swift->close();
} else {$error = true;}
return !$error;
}
?>I know it's simple, it's just always good to have a second (or third, or fourth, or ... N) pair of eyes.
Tnx