Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Configuration Start
- //
- // manual or automatic
- $automatic_mode = true;
- // Voodoo Logins
- $url = "http://pak-localhost-34Dw";
- $username = "falcon";
- $password = "07vt3mg";
- // Automated for scheduled runs
- $automated_sender_id = "447581072856";
- // Manual runs
- $manual_sender_id = "";
- $manual_destination_id = "";
- $manual_text = "";
- //
- // Configuration End
- $now = time();
- if($automatic_mode !== false){
- $db = mysql_connect("127.0.0.1", "root", "redpheonix") or die("ded");
- mysql_select_db("dontforget", $db);
- // Retreive all runs
- $myquery = mysql_query("SELECT * FROM runs WHERE active = 1");
- while($myrow = mysql_fetch_assoc($myquery)){
- $runid = $myrow["runid"];
- $label = $myrow["label"];
- $number = $myrow["number"];
- $text = $myrow["text"];
- $date_to_run = $myrow["date_to_run"];
- $recurring = $myrow["recurring"];
- if($now > $date_to_run){
- // Send the Text
- //Post variable names should be same as mentioned below example and its case sensitive as well
- $getString .= "?destin=$number&";
- $getString .= "origin=$automated_sender_id&";
- $getString .= "msg=" . urlencode($text) . "&";
- $getString .= "userid=$username&";
- $getString .= "password=$password&";
- $ch = curl_init();
- //set the url, GET data
- curl_setopt($ch,CURLOPT_URL, $url.$getString);
- curl_setopt($ch,CURLOPT_HTTPGET,1); //default
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- //execute post
- $result = curl_exec($ch);
- echo($result);
- //close connection
- curl_close($ch);
- // Set the next run
- $now = "@" . $date_to_run;
- $dt = new DateTime($now);
- if($recurring == "yearly"){
- $dt->modify('+1 year');
- $date_next_year = $dt->format('m/d/Y');
- $next_year = strtotime($date_next_year);
- mysql_query("UPDATE runs SET date_to_run = '$next_year' WHERE runid = '$runid'");
- }elseif($recurring == "monthly"){
- $dt->modify('+1 month');
- $date_next_month = $dt->format('m/d/Y');
- $next_month = strtotime($date_next_month);
- mysql_query("UPDATE runs SET date_to_run = '$next_month' WHERE runid = '$runid'");
- }else{
- // One-time email, set it to be unactive
- mysql_query("UPDATE runs SET active = 0 WHERE runid = '$runid'");
- }
- }
- }
- }else{
- // Manual
- //Post variable names should be same as mentioned below example and its case sensitive as well
- $getString .= "?destin=$manual_destination_id&";
- $getString .= "origin=$manual_sender_id&";
- $getString .= "msg=" . urlencode($manual_text) . "&";
- $getString .= "userid=$username&";
- $ch = curl_init();
- //set the url, GET data
- curl_setopt($ch,CURLOPT_URL, $url.$getString);
- curl_setopt($ch,CURLOPT_HTTPGET,1); //default
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- //execute post
- $result = curl_exec($ch);
- echo($result);
- //close connection
- curl_close($ch);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement