-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubscribe.php
88 lines (78 loc) · 1.72 KB
/
subscribe.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
<?php
/**
* @package WP-MailUp
* Subscribe request to xmlSubscribe.aspx
*/
/**
* Response codes: (xmlSubscribe.aspx)
* 0 - Operation completed with success
* 1 - Generic error
* 2 - Invalid email address or phone number
* 3 - User already subscribed
* Response codes: custom
* 10 - terms and conditions not accepted
*/
if(@$_REQUEST['termsAccept'] != 'yes')
{
exit('10');
}
if(@$_REQUEST['token'] == 'subscribe')
{
$url = @$_REQUEST['subsUrl'];
if(trim($url) == '')
{
exit('1');
}
$post_data = '';
$post_data .= "source=wordpress";
if($_REQUEST['Email'])
{
$post_data .= "&Email=".$_REQUEST['Email'];
}
if($_REQUEST['sms'])
{
$post_data .= "&sms=".$_REQUEST['sms'];
}
if($_REQUEST['List'])
{
$post_data .= "&List=".$_REQUEST['List'];
}
if($_REQUEST['Group'])
{
$post_data .= "&Group=".$_REQUEST['Group'];
}
if($_REQUEST['Confirm'])
{
$post_data .= "&Confirm=".$_REQUEST['Confirm'];
}
if($_REQUEST['csvFldNames'])
{
$post_data .= "&csvFldNames=".$_REQUEST['csvFldNames'];
}
if($_REQUEST['csvFldValues'])
{
$post_data .= "&csvFldValues=".$_REQUEST['csvFldValues'];
}
$post_data .= "&retCode=1";
if(!function_exists('curl_init'))
{
exit(1);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
$response = trim($response);
if(($response != '0') && ($response != '1') && ($response != '2') && ($response != '3')&& ($response != '-1011'))
{
exit('1');
}
else
{
echo $response;
}
}
?>