Last active
December 31, 2015 19:39
-
-
Save ksnider/8035214 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Connect to Infusionsoft | |
| require_once("isdk.php"); | |
| $app = new iSDK; | |
| $app->cfgCon("connectionName"); | |
| // Create your own test contact and hard code here when testing. be sure to comment out | |
| // the three $POST variables above. These are either-or. | |
| // $contactId = 19709; | |
| // $email = 'major@kimsnider.com'; | |
| // $dateOnly = time(); | |
| // Add the contact to the reminder database | |
| // Connect to mySQL | |
| $con = mysql_connect("localhost","ksnider_kim","password"); | |
| // Get Contact info from POST variable | |
| mysql_real_escape_string($_POST['contactId']); | |
| mysql_real_escape_string($_POST['email']); | |
| $dateOnly = $_POST['nextDate']; | |
| // If it can't connect ... | |
| if (!$con) | |
| { | |
| die('Could not connect: ' . mysql_error()); | |
| } | |
| // Connect to database | |
| $db = mysql_select_db("ksnider_reminders", $con); | |
| // If it can't connect ... | |
| if (!$db) | |
| { | |
| die('Could not find db: ' . mysql_error()); | |
| } | |
| /* Set send time to one hour before the webinar | |
| * Note that for testing purposes we set the webinar date to the current time. | |
| * That means the send date/time will be an hour ago. That will cause the next step, | |
| * which is to send the one hour reminder to run. When you change to the $_POST variable | |
| * that won't happen. | |
| */ | |
| $web_date = strtotime($dateOnly); | |
| $send_email = date("Y-m-d H:i:s",strtotime('-60 minutes',$web_date)); | |
| // Define the mySQL query you want to run. In this case it is an INSERT query because we | |
| // are inserting a new row into the table for each email we need to send. | |
| $query = " | |
| INSERT INTO `ksnider_reminders`.`webinar_1hr_email` (`contactId`, `email`, `send`, `sent`) VALUES ('$contactId', '$email', '$send_email', ''); | |
| "; | |
| // Execute the query specified above | |
| echo mysql_query($query); | |
| echo "Done"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment