Commit | Line | Data |
---|---|---|
c4f9ed02 PM |
1 | <?PHP |
2 | include_once('../email.php'); | |
64feb164 | 3 | |
c4f9ed02 PM |
4 | $base_message = "I just wanted to take a second and follow up with your visit to md-petition.com and see if you needed anything, or had any questions."; |
5 | ||
6 | // USAGE meps_mail('Patrick <baltimorehacker@gmail.com>','','Petition Follow-Up'); | |
7 | ||
64feb164 | 8 | $q="SELECT * FROM follow_up where status = 'NEW'"; |
c4f9ed02 PM |
9 | $r = $petition->query($q); |
10 | while($d = mysqli_fetch_array($r)){ | |
64feb164 | 11 | $name = $d['name']; |
91445973 | 12 | $email = $d['email']; |
64feb164 PM |
13 | $q2 = "SELECT * FROM presign where php_session_id = '$d[php_session]'"; |
14 | $r2 = $petition->query($q2); | |
91445973 | 15 | $presign = mysqli_fetch_array($r2); |
64feb164 | 16 | $visit = $presign['action_on']; |
91445973 PM |
17 | $invite=''; |
18 | $petition_name='Maryland'; | |
19 | if($d['petition_id'] != '0'){ | |
20 | $q2 = "SELECT * FROM petitions where petition_id = '$d[petition_id]'"; | |
21 | $r2 = $petition->query($q2); | |
22 | $petitions = mysqli_fetch_array($r2); | |
23 | $petition_name = $petitions['petition_name']; | |
24 | $landing_page = $petitions['landing_page']; | |
25 | $web_short_name = $petitions['web_short_name']; | |
26 | $link = 'https://www.md-petition.com/?invite='.$web_short_name; | |
27 | if ($landing_page != ''){ | |
28 | $link = 'https://www.md-petition.com/'.$landing_page; | |
29 | } | |
30 | $invite = "<br><br>Petition: $petition_name at <a href='$link'>$link</a>"; | |
64feb164 | 31 | } |
64feb164 PM |
32 | $last = "<br><br>Follow up was requested at $visit"; |
33 | $body = $base_message.$invite.$last; | |
34 | $subject = "$petition_name Petition Follow-Up"; | |
35 | $to = "$name <$email>"; | |
36 | $feedback_message = "TO: $to SUB: $subject MSG: $body sent on ".date('r')." by ".$_COOKIE['name']; | |
850093f5 | 37 | meps_mail($to,$body,$subject); |
64feb164 | 38 | $feedback_message = $petition->real_escape_string($feedback_message); |
850093f5 | 39 | $petition->query("update follow_up set status = 'sent', feedback_message = '$feedback_message' where id = '$d[id]' "); |
c4f9ed02 PM |
40 | } |
41 | ||
42 | ?> |