Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head></head>
- <?php
- // Make a MySQL Connection
- $con = mysql_connect("xxx", "volunteers2012", "xxx");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("volunteers2012", $con);
- mysql_real_escape_string($unescaped_string, $con);
- function checkEmail($email) {
- $email = mysql_real_escape_string($email);
- $sql = mysql_query("SELECT * FROM vols2012 WHERE email='$email'");
- if (mysql_num_rows($sql) == 0) {
- return true;
- }
- return false;
- }
- if (checkEmail($_POST['email'])) {
- // Continue insert
- } else {
- die( "There is already a user with that email!" ) ;
- }
- function check_input($data, $problem='')
- {
- $data = trim($data);
- $data = stripslashes($data);
- $data = htmlspecialchars($data);
- }
- $sql="INSERT INTO vols2012 (id, agreeName, last_name, first_name, age, gender, phone, email, facebook, street_no, city, state, zip, attended, volbefore, volbeforeyes, cpr, tabc, skills, avail, shirt)
- VALUES ('', '$_POST[agreeName]', '$_POST[last_name]', '$_POST[first_name]', '$_POST[age]', '$_POST[gender]', '$_POST[phone]', '$_POST[email]', '$_POST[facebook]', '$_POST[street_no]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[attended]', '$_POST[volbefore]', '$_POST[volbeforeyes]', '$_POST[cpr]', '$_POST[tabc]', '$_POST[skills]', '$_POST[avail]', '$_POST[shirt]')";
- if(mysql_query($sql))
- ?>
- <?php
- $agreeName = check_input($_POST['agreeName'], "Form incomplete. You did not add your electronic signature. Please go back and sign the release at the end of the form.");
- $lastname = check_input($_POST['last_name'], "Form incomplete. Enter your last name.");
- $firstname = check_input($_POST['first_name'], "Form incomplete. Enter your first name.");
- $age = check_input($_POST['age'], "Form incomplete. Enter your age.");
- $gender = check_input($_POST['gender'], "Form incomplete. Enter your gender.");
- $phone = check_input($_POST['phone'], "Form incomplete. Enter your phone number.");
- $email = check_input($_POST['email'], "Form incomplete. Enter your email address.");
- $street_no = check_input($_POST['street_no'], "Form incomplete. Please enter your address where you currently reside. This helps us when scheduling positions and meetings.");
- $city = check_input($_POST['city'], "Form incomplete. Please enter your city.");
- $state = check_input($_POST['state'], "Form incomplete. Please enter your state.");
- $zip = check_input($_POST['zip'], "Form incomplete. Please enter your zipcode.");
- $shirt = check_input($_POST['shirt'], "Form incomplete. Please enter your t-shirt size.");
- ?>
- <body>
- <div id="holding">
- <span class="choice bigboldfont" style="font-size:22px">
- <p>Thank you <?php echo $_POST['agreeName'];?>! Your application to volunteer at the Free Press Summer Fest 2012 is being processed.</p>
- <p>We will send you more information soon to your email address at <span class="font_orange"><?php echo $_POST['email'];?></span></p>
- </span>
- </div>
- </div></div>
- </div>
- </div>
- </div>
- </body>
- </html>
- <?php
- if ($problem && strlen($data) == 0)
- {
- show_error($problem);
- }
- return $data;
- function show_error($myError)
- {
- ?>
- <div id="holding2">
- <span class="error_text">
- <b><i>Please correct the following error:</i></b><br /><br />
- <?php echo $emailError; ?>
- <?php echo $myError; ?></span><br /><br />
- <a style="#fe1e2d" href="#" onclick="history.go(-1);return false;"><span class="error_text2 font_orange">Click back on your browser or here to return to form</span></a>
- </div>
- <?php
- exit();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement