This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
forked from sameenjalal/HackRU
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresume_drop.php
138 lines (115 loc) · 4.48 KB
/
resume_drop.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
$errors = array();
if($_REQUEST['submit']) {
$email = $_REQUEST['email'];
$project = $_REQUEST['project'];
$description = $_REQUEST['project_description'];
//email is valid
if(!$email || !preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $email)) {
$errors[] = "Your email is invalid.";
}
if(!$project) {
$errors[] = "Give me the title of your HackRU project.";
}
if(!$description) {
$errors[] = "Give me a short description of your HackRU project.";
}
if(!$_FILES || !$_FILES['resume']) {
$errors[] = "You need to upload a resume";
}
if(!$errors) {
$file_contents = "";
$file_contents .= "Email: $email\n";
$file_contents .= "Project Title: $project\n";
$file_contents .= "Project Description: $description\n";
$filename = basename($email);
$upload_dir = "/var/www/servers/hackru.org/uploads";
$file_path = $upload_dir.'/'.$filename.'.txt';
$ext = substr($_FILES['resume']['name'], strrpos($_FILES['resume']['name'], '.') + 1);
$resume_path = $upload_dir.'/'.$filename.'.'.$ext;
file_put_contents($file_path, $file_contents);
if(move_uploaded_file($_FILES['resume']['tmp_name'], $resume_path)) {
}
else {
$errors[] = "Uploading the file failed.";
}
}
}
else {
$email = "";
$project = "";
$description = "";
}
?>
<!doctype html>
<!--
__ __ ______ ______ __ __ ______ __ __
/\ \_\ \/\ __ \/\ ___\/\ \/ / /\ == \/\ \/\ \
\ \ __ \ \ __ \ \ \___\ \ _"-. \ \ __<\ \ \_\ \
\ \_\ \_\ \_\ \_\ \_____\ \_\ \ \ \ \_\ \_\ \_____\
\/_/\/_/\/_/\/_/\/_____/\/_/\/_/ \/_/ /_/\/_____/
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>HackRU - An incredible opportunity for learning and creation</title>
<link rel="stylesheet" href="stylesheets/foundation.min.css">
<link rel="stylesheet" href="stylesheets/style.css">
<link rel="icon" type="image/x-icon" href="./images/favicon.ico">
<script src="javascripts/modernizr.foundation.js"></script>
<!--[if lt ie 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<h2 id="logo">
<a href="/"><img src="./images/hackru_logo.png" alt="HackRU" /></a>
</h2>
<h3 class="subheader hosted">Hosted by <a href="http://usacs.rutgers.edu">The Undergraduate Student Alliance of Computer Scientists</a></h3>
</div>
<div class="row shadow">
<div class="row panel opaque">
<div class="row">
<div class="twelve columns centered hosted">
<ul class="nav-bar">
<li><a href="index.html">Home</a></li>
<li><a href="directions.html">Directions</a></li>
<li><a href="sponsors.html">Sponsors</a></li>
<li><a href="photos.html">Photos</a></li>
<li><a href="workshops.html">Workshops</a></li>
<li><a href="prizes.html">Prizes</a></li>
</ul>
</div>
</div>
<div class="row panel opaque">
<h1> Resume Drop </h1>
<?php if($errors || !$_REQUEST['submit']): ?>
<p> Filling this form will send your resume to our sponsors. </p>
<ul>
<?php foreach($errors as $error): ?>
<li> <?= $error; ?> </li>
<?php endforeach; ?>
</ul>
<form action="resume_drop.php" enctype="multipart/form-data" method="POST">
<label for="email"> Email </label>
<input type="text" name="email" id="email" value="<?= htmlspecialchars($email) ?>" />
<label for="project"> HackRU Project Title </label>
<input type="text" name="project" id="project" value="<?= htmlspecialchars($project) ?>" />
<label for="project_description"> HackRU Project Description </label>
<input type="text" name="project_description" id="project_description" value="<?= htmlspecialchars($project_description) ?>" />
<label for="resume"> Resume </label>
<input type="file" name="resume" id="resume" />
<input type="submit" class="button" value="Submit" name="submit" />
</form>
<?php else: ?>
<div class="alert-box success">
Successfully added your resume. Thanks!
</div>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>