commit f1dca0c75c83dcbb78b02926bd71a76643e99618
parent 3ad84a437f7dbfb7ecadb042c1ba991aa60a3e2a
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date: Wed, 31 Dec 2014 20:47:49 -0500
utils.php: added request_shoot() function.
Diffstat:
utils.php | | | 55 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++- |
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/utils.php b/utils.php
@@ -71,7 +71,7 @@ function register($email) {
mail($to,$email_subject,$email_body,$headers);
$alert_msg = 'You have registered for <strong>'
- . $course . '</strong> Vishwa Manoharan get back to you seen.';
+ . $course . '</strong> Vishwa Manoharan get back to you soon.';
$alert = array( 'type' => 'success',
'content' => $alert_msg);
@@ -85,4 +85,57 @@ function register($email) {
'content' => $alert_msg);
}
return $alert;
+}
+
+
+function request_shoot($email) {
+ $to = $email;
+ $name = $_POST['name'];
+ $email_address = $_POST['email'];
+ $phone = $_POST['phone'];
+ $shoot_t = $_POST['shoot_type'];
+ $shoot_date = $_POST['shoot_date'];
+ $other_details = $_POST['other_details'];
+ $humantest = $_POST['humantest'];
+ $submit = $_POST['submit'];
+
+ $humantest_answer= "99";
+
+ if((strcmp($humantest, $humantest_answer)== 0) and
+ (!empty($name) and !empty($email_address))) {
+
+ $email_subject = "[VishaMano.com] A&S Shoot Request from $name";
+
+ $email_body = "$name <$email_address> has requested for a A&S Photo Shoot on $shoot_date. \n\n".
+ "Type of Shoot: $shoot_t";
+
+ if(!empty($other_details)) {
+ $email_body .= "\n\nOther Details: $other_details";
+ }
+
+ if(!empty($phone)) {
+ $email_body .= "\n\n$name can be buzzed at $phone";
+ }
+
+ $headers = "From: no-reply@vishwamano.com\n";
+ $headers .= "Reply-To: $email_address";
+
+ mail($to, $email_subject, $email_body, $headers);
+
+ $alert_msg = 'You have got your request for <strong>'
+ . $shoot_t . '</strong> on <strong>'
+ . $shoot_date. '</strong>. Vishwa Manoharan get back to you soon.';
+ $alert = array( 'type' => 'success',
+ 'content' => $alert_msg);
+
+ }
+ else {
+ $alert_msg = '<strong> Shoot Request unsuccessful</strong>. Please try again.'
+ . ' If problem persists email Vishwa Manoharan'
+ . ' <vishwa91photography@gmail.com>.';
+ $alert = array( 'type' => 'danger',
+ 'content' => $alert_msg);
+ }
+
+ return $alert;
}
\ No newline at end of file