Skip to content

Commit 074f575

Browse files
committed
edited formatting, cleaned up some code
1 parent 69f10a4 commit 074f575

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ <h1>Sponsors</h1>
8585
</p>
8686
</div><!-- end sponsors -->
8787

88-
<div class="container-fluid" style="background-color: #222;color: #FFF">
88+
<div class="container-fluid" style="background-color: #222;color: #FFF;padding-bottom: 10px;">
8989
<div id="contact" class="container">
9090
<h1>Contact Us</h1>
9191
<p>Sponsors can contact us here</p>

register.php

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,42 @@
33
include_once 'config.php';
44

55
// db connection
6-
$pdo = new PDO($config['db']['connString'], $config['db']['username'], $config['db']['password']);
7-
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
8-
9-
if(isset($_POST['fname'], $_POST['lname'], $_POST['age'], $_POST['email'], $_POST['diet_res'], $_POST['shirt_size'])) {
10-
//make user resume name string
11-
$resume_dir = "resumes";
12-
$resume_filename = $_POST['fname'].'_'.$_POST['lname'].'_'.$_POST['age'].'.'.end(explode('.',$_FILES['resume']['name']));
13-
14-
$stmt = $pdo->prepare ("INSERT INTO users (fname, lname, age, email, resume_path, diet_res, shirt_size) VALUES (:fname, :lname, :age, :email, :resume_path, :diet_res, :shirt_size)");
15-
$stmt->bindParam(':fname', $_POST['fname']);
16-
$stmt->bindParam(':lname', $_POST['lname']);
17-
$stmt->bindParam(':age', $_POST['age']);
18-
$stmt->bindParam(':email', $_POST['email']);
19-
$stmt->bindValue(':resume_path', $resume_filename);
20-
$stmt->bindParam(':diet_res', $_POST['diet_res']);
21-
$stmt->bindParam(':shirt_size', $_POST['shirt_size']);
22-
23-
$stmt->execute();
24-
25-
move_uploaded_file($_FILES['resume']['tmp_name'], "$resume_dir/$resume_filename");
26-
/*
27-
$headers = 'From: '.$_POST['email'] . "\r\n" .
28-
'Reply-To: '.$_POST['email'] . "\r\n" .
29-
'X-Mailer: PHP/' . phpversion();
30-
31-
$confirm_msg = 'Thank you for regisitering for Old Domimion ACM\'s Monarchs hack the campus.<a href="">Click here</a> to confirm it is really you.';
32-
33-
mail($_POST['email'], 'Monarchs Hack Registration', $confirm_msg, $headers);
34-
header('Location: thankyou.php?name='.urlencode($_POST['fname'].' '.$_POST['lname']));
35-
*/
36-
header('Location: index.html');
37-
6+
try {
7+
$pdo = new PDO($config['db']['connString'], $config['db']['username'], $config['db']['password']);
8+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
9+
10+
if(isset($_POST['fname'], $_POST['lname'], $_POST['age'], $_POST['email'], $_POST['diet_res'], $_POST['shirt_size'])) {
11+
//make user resume name string
12+
$resume_dir = "resumes";
13+
$resume_filename = $_POST['fname'].'_'.$_POST['lname'].'_'.$_POST['age'].'.'.end(explode('.',$_FILES['resume']['name']));
14+
15+
$stmt = $pdo->prepare ("INSERT INTO users (fname, lname, age, email, resume_path, diet_res, shirt_size) VALUES (:fname, :lname, :age, :email, :resume_path, :diet_res, :shirt_size)");
16+
$stmt->bindParam(':fname', $_POST['fname']);
17+
$stmt->bindParam(':lname', $_POST['lname']);
18+
$stmt->bindParam(':age', $_POST['age']);
19+
$stmt->bindParam(':email', $_POST['email']);
20+
$stmt->bindValue(':resume_path', $resume_filename);
21+
$stmt->bindParam(':diet_res', $_POST['diet_res']);
22+
$stmt->bindParam(':shirt_size', $_POST['shirt_size']);
23+
24+
$stmt->execute();
25+
26+
move_uploaded_file($_FILES['resume']['tmp_name'], "$resume_dir/$resume_filename");
27+
/*
28+
//use uniqueid to generate key for user email confirmation
29+
$headers = 'From: '.$_POST['email'] . "\r\n" .
30+
'Reply-To: '.$_POST['email'] . "\r\n" .
31+
'X-Mailer: PHP/' . phpversion();
32+
33+
$confirm_msg = 'Thank you for regisitering for Old Domimion ACM\'s Monarchs hack the campus.<a href="">Click here</a> to confirm it is really you.';
34+
35+
mail($_POST['email'], 'Monarchs Hack Registration', $confirm_msg, $headers);
36+
header('Location: thankyou.php?name='.urlencode($_POST['fname'].' '.$_POST['lname']));
37+
*/
38+
header('Location: index.html');
39+
}
40+
} catch (PDOException $e) {
41+
echo '<div class="alert alert-danger">Connection Failed: '.$e->getMessage().'</div>';
3842
}
3943

4044
?>

0 commit comments

Comments
 (0)