Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //------------------- Edit here --------------------//
- $sendy_url = 'http://your.sendy.installation';
- $list = $_POST['list'];
- //------------------ /Edit here --------------------//
- //--------------------------------------------------//
- //POST variables
- $name = $_POST['name'];
- $email = $_POST['email'];
- //url2 is used not let spammers subscribe by putting a hidden field in the form.
- $url2 = $_POST['url2'];
- //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
- //if url2 is completed, don't subscribe (but it gives a success message to the bot (in the .js script)
- if($url2) {
- echo "bleah";
- }
- else {
- //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
- $postdata = http_build_query(
- array(
- 'name' => $name,
- 'email' => $email,
- 'list' => $list,
- 'boolean' => 'true'
- )
- );
- $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
- $context = stream_context_create($opts);
- $result = file_get_contents($sendy_url.'/subscribe', false, $context);
- echo $result;
- //you can erase this part if you only want to check for spammers but not send an email notification
- if($result == "1") {
- //you can add more custom fields with the . (dot) function.
- mail('email.address.to.send.the.notification@yourmail.com', 'Subject of the email', $message.$name."\n".$email); }
- //erase until here if you don't want to send mail notification
- };
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement