View difference between Paste ID: 9GTERtai and XX7Bigtr
SHOW: | | - or go back to the newest paste.
1
<?php 
2
	//------------------- Edit here --------------------//
3
	$sendy_url = 'http://your.sendy.installation';
4
	$list = $_POST['list'];
5
	//------------------ /Edit here --------------------//
6
7
	//--------------------------------------------------//
8
	//POST variables
9
	$name = $_POST['name'];
10
	$email = $_POST['email'];
11
//url2 is used not let spammers subscribe by putting a hidden field in the form.
12
	$url2 = $_POST['url2']; 
13
//put here any other custom fields you have in the same way as url2 or email or name. Make sure the name in the [''] matches the id of the input field from the html and js file
14
15
16
//if url2 is completed, don't subscribe (but it gives a success message to the bot (in the .js script)
17
	if($url2) {
18
	echo "bleah";
19
	 }
20
	else {
21
      //subscribe, put here all the other custom fields. I didn't put url2 because it's only used in this php to check if it's filled
22
	$postdata = http_build_query(
23
	    array(
24
	    'name' => $name,
25
	    'email' => $email,
26
	    'list' => $list,
27-
	
27+
28
	    )
29
	);
30-
	echo "nu merge";
30+
31
	$context  = stream_context_create($opts);
32-
	else {echo $result;
32+
33
34-
	$message = "You have a new subscriber with the following details:\n";
34+
	echo $result;
35
36
//you can erase this part if you only want to check for spammers but not send an email notification
37-
// Send
37+
38
//you can add more custom fields with the . (dot) function.
39
mail('[email protected]', 'Subject of the email', $message.$name."\n".$email); }
40
//erase until here if you don't want to send mail notification
41
	};
42
?>