-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm.php
50 lines (41 loc) · 1.52 KB
/
confirm.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
<?php
global $wpdb;
$string = $_GET['wpr-confirm'];
$args = base64_decode($string);
$args = explode("%%",$args);
$id = (int) $args[0];
$hash = trim($args[1]);
if (get_magic_quotes_gpc()==1)
{
$hash = addslashes($hash);
}
$subscribers_table = $wpdb->prefix."wpr_subscribers";
$query = $wpdb->prepare("SELECT * FROM $subscribers_table WHERE id=%d AND hash='%s' AND active=1 AND confirmed=0",$id,$hash);
$subs = $wpdb->get_results($query);
if (count($subs) == 0)
{
?>
<div align="center"><h2>Your subscription does not exist or you are already subscribed. </h2></div>
<?php
exit;
}
$subs = $subs[0];
$query = $wpdb->prepare("UPDATE $subscribers_table set confirmed=1, active=1 where id=%d and hash='%s';",$id,$hash);
$wpdb->query($query);
$redirectionUrl = home_url("/?wpr-confirm=2");
$subscriber = _wpr_subscriber_get($id);
_wpr_move_subscriber($subscriber->nid,$subscriber->email);
//This subscriber's follow up subscriptions' time of creation should be updated to the time of confirmation.
$currentTime = time();
$followup_subscriptions_table = $wpdb->prefix."wpr_followup_subscriptions";
$query = $wpdb->prepare("UPDATE $followup_subscriptions_table SET doc='%s', last_date='%s' WHERE sid=%d;",$currentTime,$currentTime,$id);
$wpdb->query($query);
do_action("_wpr_subscriber_confirmed",$id);
sendConfirmedEmail($id);
?>
<script>
window.location='<?php echo $redirectionUrl ?>';
</script>
<?php
$size = ob_get_length();
do_action("_wpr_autoresponder_process_subscriber_day_zero",$id);