Advertisement
plas71k

decoded file

Dec 11th, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 20.57 KB | None | 0 0
  1. <?php
  2. require_once('page_contents.php');
  3. require_once('cc_class.php');
  4.  
  5. function wbr_create_admin_menu()
  6. {
  7.     add_menu_page('WB Reviews', 'SMSchema', 'administrator','wbr_main','wbr_add_main_page_contents');
  8.     add_submenu_page('wbr_main','Settings','Settings','administrator','wbr_main','wbr_add_main_page_contents');
  9.     add_submenu_page('wbr_main','Campaigns','Campaigns','administrator','wbr_campaigns','wbr_add_campaigns_page_contents');
  10.     add_submenu_page('wbr_main','Reviews','Reviews','administrator','wbr_reviews','wbr_add_reviews_page_contents');
  11.     add_submenu_page('wbr_main','Messages','Messages','administrator','wbr_messages','wbr_add_messages_page_contents');
  12. }
  13.  
  14. function wbr_admin_notice(){
  15.     global $pagenow;
  16.     if(isset($_SESSION['wbr_admin_notice']) && !empty($_SESSION['wbr_admin_notice']))
  17.     {
  18.         if($pagenow == 'admin.php')
  19.         {
  20.             echo '<div class="updated" style="color:#21759B;">
  21.               <p>'.$_SESSION['wbr_admin_notice'].'</p>
  22.            </div>';
  23.         }
  24.         unset($_SESSION['wbr_admin_notice']);
  25.     }
  26. }
  27.  
  28. function wbr_redirect_page($URL)
  29. {
  30.     ?>
  31.     <script type="text/javascript">
  32.         window.location = "<?=$URL?>";
  33.     </script>
  34.     <?php
  35.     die();
  36. }
  37.  
  38. function wbr_init_sessions() {
  39.     if (!session_id()) {
  40.         session_start();
  41.     }
  42. }
  43.  
  44. function wbr_drop_table()
  45. {
  46.     global $wpdb;
  47.      
  48.     $pre = $wpdb->prefix;
  49.     $table[0] = $pre."wbr_states";
  50.     $table[1] = $pre."wbr_area_codes";
  51.     $table[2] = $pre."wbr_client_info";
  52.     $table[3] = $pre."wbr_phone_numbers";
  53.     $table[4] = $pre."wbr_campaigns";
  54.     $table[5] = $pre."wbr_camp_questions";
  55.     $table[6] = $pre."wbr_reviews_answers";
  56.     $table[7] = $pre."wbr_reviews";
  57.     $table[8] = $pre."wbr_scheduler";
  58.     //$table[9] = $pre."wbr_html_code";
  59.     $table[9] = $pre."wbr_sms_history";
  60.     $table[10] = $pre."wbr_auto_responder";
  61.     $table[11] = $pre."wbr_review_customize";
  62.          
  63.     for($i=0; $i<count($table); $i++)
  64.     {
  65.         $Table_name = $table[$i];
  66.         $query = $wpdb->query("DROP TABLE IF EXISTS $Table_name");
  67.     }
  68.     update_option('wb_reviews_ver','0.0');
  69. }
  70.  
  71. function wbr_db_table()
  72. {
  73.     global $wpdb;
  74.     global $jal_db_version;
  75.      
  76.     $Table_name = $wpdb->prefix . 'wbr_states';
  77.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  78.         $sql = "CREATE TABLE $Table_name
  79.        (
  80.            `id` int(11) NOT NULL AUTO_INCREMENT,
  81.            `State` varchar(255) NOT NULL,
  82.            `Code` varchar(255) NOT NULL,
  83.            `Status` varchar(255) NOT NULL,
  84.             PRIMARY KEY (`id`)
  85.        );";    
  86.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  87.         if(dbDelta($sql))
  88.         {
  89.             $tabl_insert = $wpdb->prefix.'wbr_states';
  90.             $filename = WBR_PluginURL.'db_files/wbr_states.csv';
  91.             wbr_insert_in_db($filename, $tabl_insert);
  92.         }
  93.     }
  94.  
  95.     $Table_name = $wpdb->prefix . 'wbr_area_codes';
  96.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  97.         $sql = "CREATE TABLE $Table_name
  98.        (
  99.            `id` int(11) NOT NULL AUTO_INCREMENT,
  100.            `StateCode` varchar(255) NOT NULL,
  101.            `AreaCode` varchar(255) NOT NULL,
  102.            `IsActive` tinyint(3) NOT NULL,
  103.            `Status` tinyint(3) NOT NULL,
  104.             PRIMARY KEY (`id`)
  105.        );";    
  106.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  107.         if(dbDelta($sql))
  108.         {
  109.             $tabl_insert = $wpdb->prefix.'wbr_area_codes';
  110.             $filename = WBR_PluginURL.'db_files/wbr_area_codes.csv';
  111.             wbr_insert_in_db($filename, $tabl_insert);
  112.         }
  113.     }
  114.      
  115.     $Table_name = $wpdb->prefix . 'wbr_client_info';
  116.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  117.         $sql = "CREATE TABLE $Table_name
  118.        (
  119.            `id` int(11) NOT NULL AUTO_INCREMENT,
  120.            `AccountSid` varchar(255) NOT NULL,
  121.            `AuthTocken` varchar(255) NOT NULL,
  122.            `Licence_Email` varchar(512) NOT NULL,
  123.            `Schema_Description` longtext NOT NULL,
  124.            `Schema_Img` text NOT NULL,
  125.            `TwilioPhoneNumber` varchar(255) NOT NULL,
  126.            `WBSMS_Username` varchar(255) NOT NULL,
  127.            `WBSMS_Password` varchar(255) NOT NULL,
  128.            `WBSMS_Domain` varchar(510) NOT NULL,
  129.             PRIMARY KEY (`id`)
  130.        );";    
  131.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  132.         dbDelta($sql);
  133.     }
  134.  
  135.     $Table_name = $wpdb->prefix . 'wbr_phone_numbers';
  136.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  137.         $sql = "CREATE TABLE $Table_name
  138.        (
  139.            `id` int(11) NOT NULL AUTO_INCREMENT,
  140.            `TwilioPhoneNo` varchar(255) NOT NULL,
  141.            `PhoneSid` varchar(255) NOT NULL,
  142.            `Type` int(11) NOT NULL,
  143.            `Status` int(11) NOT NULL,
  144.            `CreatedUser` int(11) NOT NULL,
  145.            `CreatedDate` datetime,
  146.             PRIMARY KEY (`id`)
  147.        );";    
  148.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  149.         dbDelta($sql);
  150.     }
  151.  
  152.     $Table_name = $wpdb->prefix . 'wbr_campaigns';
  153.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  154.         $sql = "CREATE TABLE $Table_name
  155.        (
  156.            `id` int(11) NOT NULL AUTO_INCREMENT,
  157.            `Name` varchar(255) NOT NULL,
  158.            `Keyword` varchar(255) NOT NULL,
  159.            `Phone_Number` varchar(255) NOT NULL,
  160.            `WBSMS_Campaign` varchar(255) NOT NULL,
  161.            `Threshold` varchar(255) NOT NULL,
  162.            `OfferExpiry` int(11) NOT NULL,
  163.            `Start_Campaign` tinyint(4) NOT NULL,
  164.            `Start_Campaign_Days` varchar(255) NOT NULL,
  165.            `Start_Campaign_Time` varchar(255) NOT NULL,
  166.            `Thank_U_Msg` varchar(255) NOT NULL,
  167.            `AR_Company` tinyint(4) NOT NULL,
  168.            `Auto_Responder_Code` longtext NOT NULL,
  169.            `CC_User` varchar(255) NOT NULL,
  170.            `CC_Pass` varchar(255) NOT NULL,
  171.            `CC_API_Key` varchar(512) NOT NULL,
  172.            `CC_List_ID` varchar(255) NOT NULL,
  173.            `CreatedDate` datetime,
  174.             PRIMARY KEY (`id`)
  175.        );";    
  176.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  177.         dbDelta($sql);
  178.     }
  179.  
  180.     $Table_name = $wpdb->prefix . 'wbr_camp_questions';
  181.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  182.         $sql = "CREATE TABLE $Table_name
  183.        (
  184.            `id` int(11) NOT NULL AUTO_INCREMENT,
  185.            `Camp_ID` int(11) NOT NULL,
  186.            `Type` tinyint(4) NOT NULL,
  187.            `Question` varchar(255) NOT NULL,
  188.            `PBD` tinyint(4) NOT NULL,
  189.            `CreatedDate` datetime,
  190.             PRIMARY KEY (`id`)
  191.        );";    
  192.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  193.         dbDelta($sql) or die('table error');
  194.     }
  195.  
  196.     $Table_name = $wpdb->prefix . 'wbr_reviews_answers';
  197.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  198.         $sql = "CREATE TABLE $Table_name
  199.        (
  200.            `id` int(11) NOT NULL AUTO_INCREMENT,
  201.            `Review_ID` int(11) NOT NULL,
  202.            `Camp_ID` int(11) NOT NULL,
  203.            `Q_ID` int(11) NOT NULL,
  204.            `Type` tinyint(4) NOT NULL,
  205.            `Answer` varchar(512) NOT NULL,
  206.            `Status` tinyint(4) NOT NULL,
  207.            `CreatedDate` datetime,
  208.             PRIMARY KEY (`id`)
  209.        );";    
  210.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  211.         dbDelta($sql) or die('table error');
  212.     }
  213.  
  214.     $Table_name = $wpdb->prefix . 'wbr_reviews';
  215.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  216.         $sql = "CREATE TABLE $Table_name
  217.        (
  218.            `id` int(11) NOT NULL AUTO_INCREMENT,
  219.            `Phone_Number` varchar(255) NOT NULL,
  220.            `Name` varchar(255) NOT NULL,
  221.            `Email` varchar(255) NOT NULL,
  222.            `Camp_ID` int(11) NOT NULL,
  223.            `Current_Q_ID` int(11) NOT NULL,
  224.            `Status` tinyint(4) NOT NULL,
  225.            `Publish` tinyint(4) NOT NULL,
  226.            `CreatedDate` datetime,
  227.             PRIMARY KEY (`id`)
  228.        );";    
  229.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  230.         dbDelta($sql) or die('table error');
  231.     }
  232.  
  233.     $Table_name = $wpdb->prefix . 'wbr_scheduler';
  234.     if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  235.         $sql = "CREATE TABLE $Table_name
  236.        (
  237.            `id` int(11) NOT NULL AUTO_INCREMENT,
  238.            `Review_ID` int(11) NOT NULL,
  239.            `Status` tinyint(4) NOT NULL,
  240.            `Start_Date` datetime,
  241.             PRIMARY KEY (`id`)
  242.        );";    
  243.         include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  244.         dbDelta($sql) or die('table error');
  245.     }
  246. }
  247.  
  248. function wbr_alter_table()
  249. {
  250.     global $wpdb;
  251.     global $wb_reviews_ver;
  252.      
  253.     $table_questions = $wpdb->prefix.'wbr_camp_questions';
  254.     $table_campaigns = $wpdb->prefix.'wbr_campaigns';
  255.     $table_reviews = $wpdb->prefix.'wbr_reviews';
  256.      
  257.     $updated = get_option('wb_reviews_ver');
  258.      
  259.     if( $updated < '3.4' )
  260.     {
  261.         $Table_name = $wpdb->prefix . 'wbr_html_code';
  262.         if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  263.             $sql = "CREATE TABLE $Table_name
  264.            (
  265.                `id` int(11) NOT NULL AUTO_INCREMENT,
  266.                `Amount` int(11) NOT NULL,
  267.                `Order_Type` varchar(255) NOT NULL,
  268.                `Min_Rating` int(11) NOT NULL,
  269.                `Publish_Camp` text NOT NULL,
  270.                `Name_Color` varchar(255) NOT NULL,
  271.                `Email_Color` varchar(255) NOT NULL,
  272.                `Date_Color` varchar(255) NOT NULL,
  273.                `Q_Color` varchar(255) NOT NULL,
  274.                `Ans_Color` varchar(255) NOT NULL,
  275.                `Frame_Width` varchar(255) NOT NULL,
  276.                `Frame_Height` varchar(255) NOT NULL,
  277.                 PRIMARY KEY (`id`)
  278.            );";    
  279.             //include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  280.             //dbDelta($sql) or die('table error');
  281.         }
  282.  
  283.         $Table_name = $wpdb->prefix . 'wbr_sms_history';
  284.         if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  285.             $sql = "CREATE TABLE $Table_name
  286.            (
  287.                `id` int(11) NOT NULL AUTO_INCREMENT,
  288.                `To` varchar(255) NOT NULL,
  289.                `From` varchar(255) NOT NULL,
  290.                `Body` longtext NOT NULL,
  291.                `Status` varchar(255) NOT NULL,
  292.                `Direction` varchar(255) NOT NULL,
  293.                 PRIMARY KEY (`id`)
  294.            );";    
  295.             include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  296.             dbDelta($sql);
  297.         }
  298.  
  299.         $Table_name = $wpdb->prefix . 'wbr_auto_responder';
  300.         if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  301.             $sql = "CREATE TABLE $Table_name
  302.            (
  303.                `id` int(11) NOT NULL AUTO_INCREMENT,
  304.                `Camp_ID` int(11) NOT NULL,
  305.                `Days` varchar(255) NOT NULL,
  306.                `Time` varchar(255) NOT NULL,
  307.                `SMS_Text` longtext NOT NULL,
  308.                `Offer_Days` varchar(255) NOT NULL,
  309.                 PRIMARY KEY (`id`)
  310.            );";    
  311.             include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  312.             dbDelta($sql);
  313.         }
  314.  
  315.         $Table_name = $wpdb->prefix . 'wbr_ar_scheduler';
  316.         if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  317.             $sql = "CREATE TABLE $Table_name
  318.            (
  319.                `id` int(11) NOT NULL AUTO_INCREMENT,
  320.                `Phone_Number` varchar(255) NOT NULL,
  321.                `Twilio_Number` varchar(255) NOT NULL,
  322.                `Message` longtext NOT NULL,
  323.                `Date` datetime NOT NULL,
  324.                `Status` tinyint(1) NOT NULL,
  325.                 PRIMARY KEY (`id`)
  326.            );";    
  327.             include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  328.             dbDelta($sql);
  329.         }
  330.          
  331.         $Table_name = $wpdb->prefix . 'wbr_review_customize';
  332.         if( !$wpdb->get_var( "SHOW TABLES LIKE $Table_name" ) ) {
  333.             $sql = "CREATE TABLE $Table_name
  334.            (
  335.                `id` int(11) NOT NULL AUTO_INCREMENT,
  336.                `Camp_ID` int(11) NOT NULL,
  337.                `Name_Color` varchar(255) NOT NULL,
  338.                `Name_Size` varchar(255) NOT NULL,
  339.                `Name_Weight` varchar(255) NOT NULL,
  340.                `Name_Style` varchar(255) NOT NULL,
  341.                `Email_Color` varchar(255) NOT NULL,
  342.                `Email_Size` varchar(255) NOT NULL,
  343.                `Email_Weight` varchar(255) NOT NULL,
  344.                `Email_Style` varchar(255) NOT NULL,
  345.                `Date_Color` varchar(255) NOT NULL,
  346.                `Date_Size` varchar(255) NOT NULL,
  347.                `Date_Weight` varchar(255) NOT NULL,
  348.                `Date_Style` varchar(255) NOT NULL,
  349.                `Q_Color` varchar(255) NOT NULL,
  350.                `Q_Size` varchar(255) NOT NULL,
  351.                `Q_Weight` varchar(255) NOT NULL,
  352.                `Q_Style` varchar(255) NOT NULL,
  353.                `Ans_Color` varchar(255) NOT NULL,
  354.                `Ans_Size` varchar(255) NOT NULL,
  355.                `Ans_Weight` varchar(255) NOT NULL,
  356.                `Ans_Style` varchar(255) NOT NULL,
  357.                 PRIMARY KEY (`id`)
  358.            );";    
  359.             include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  360.             dbDelta($sql);
  361.         }
  362.  
  363.         $alter_table_camp_disp_q = $wpdb->query("ALTER TABLE $table_questions ADD COLUMN `Disp_Question` int(11) NOT NULL DEFAULT '1' AFTER `PBD`");
  364.         $alter_table_camp_schema = $wpdb->query("ALTER TABLE $table_campaigns  ADD `Schema_Desc` LONGTEXT NOT NULL AFTER `CC_List_ID`,  ADD `Schema_Img` TEXT NOT NULL AFTER `Schema_Desc`");
  365.         $alter_offer_expiry_chkbox = $wpdb->query("ALTER TABLE $table_campaigns  ADD `OfferExpiry_Chkbox` tinyint(1) NOT NULL AFTER `OfferExpiry`");
  366.         $alter_reviews_import_date = $wpdb->query("ALTER TABLE $table_reviews  ADD `Import_Date` datetime NOT NULL AFTER `CreatedDate`");
  367.     }
  368.     update_option('wb_reviews_ver','3.4');
  369. }
  370.  
  371. function wbr_insert_in_db($Filename, $Table)
  372. {
  373.     global $wpdb;
  374.     $check = $wpdb->get_results( "SELECT * FROM $Table" );
  375.     if($check[0] == '')
  376.     {
  377.         $handle = fopen($Filename, "r");
  378.         $db_fields = '';
  379.         if($handle)
  380.         {
  381.             include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  382.             while (($data = fgetcsv($handle, 10000000, ",")) != false)
  383.             {
  384.                 if($Table == $wpdb->prefix.'wbr_states')
  385.                 {
  386.                     $data_array = array('State' => $data[0],'Code' => $data[1],'Status' => $data[2]);
  387.                     $query = $wpdb->insert($Table,$data_array);
  388.                 }
  389.                 if($Table == $wpdb->prefix.'wbr_area_codes')
  390.                 {
  391.                     $data_array = array('StateCode' => $data[0],'AreaCode' => $data[1],'IsActive' => $data[2],'Status' => $data[3]);
  392.                     $query = $wpdb->insert($Table,$data_array);
  393.                 }
  394.             }
  395.         }
  396.     }
  397. }
  398.  
  399. function wbr_check_user_curl($email, $password, $url)
  400. {
  401.     $url = $url."/handle_curl_request.php";
  402.      
  403.     $data = array('email_address'=>$email,'password'=>$password,'action'=>'client_verification');
  404.      
  405.     // makin curl request....
  406.     $ch = curl_init();
  407.     curl_setopt($ch, CURLOPT_URL,$url);
  408.     curl_setopt($ch, CURLOPT_POST, true);
  409.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);  
  410.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  411.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  412.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0');
  413.     $request = curl_exec($ch);
  414.     if($request == 'found')
  415.     {
  416.         return true;
  417.     }
  418.     else
  419.     {
  420.         return false;
  421.     }
  422.     curl_close($ch);
  423. }
  424.  
  425. function wbr_DBin($string)
  426. {
  427.     $a = html_entity_decode($string);
  428.     return trim(htmlspecialchars($a,ENT_QUOTES));
  429. }
  430. function wbr_DBout($string)
  431. {
  432.     $string = stripslashes(trim($string));
  433.     return html_entity_decode($string);
  434. }
  435.  
  436. function wbr_sendSMS($client,$From,$twilio_user_number,$SMS,$ApiVersion,$AccountSid)
  437. {
  438.     $response = $client->request("/$ApiVersion/Accounts/$AccountSid/SMS/Messages",  
  439.             "POST", array(
  440.             "To" => $From,
  441.             "From" => $twilio_user_number,
  442.             "Body" => $SMS
  443.         ));
  444.     if ($response->IsError)  
  445.     {
  446.         return $response->IsError;
  447.     }
  448.     else
  449.     {
  450.         wbr_sms_history($From, $twilio_user_number, $SMS, 'sent', 'outbound-api');
  451.         return 'MSG Sent';
  452.     }
  453. }
  454.  
  455. function wbr_sms_history($to, $from, $body, $status, $direction)
  456. {
  457.     global $wpdb;
  458.     $table_sms_hitory = $wpdb->prefix."wbr_sms_history";
  459.      
  460.     $data_array = array(
  461.         'To' => $to,
  462.         'From' => $from,
  463.         'Body' => $body,
  464.         'Status' => $status,
  465.         'Direction' => $direction
  466.     );
  467.      
  468.     $wpdb->insert($table_sms_hitory, $data_array);
  469. }
  470.  
  471. function wbr_genRandomString()
  472. {
  473.     global $wpdb;
  474.     $table_phone_numbers = $wpdb->prefix."wbr_phone_numbers";
  475.      
  476.     $couponChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  477.     $couponCharLen = (strlen($couponChars)-1);
  478.     $couponLength = 6;
  479.     $couponCode = '';
  480.     $couponCheck = '0';
  481.     while($couponCheck == '0')
  482.     {
  483.         for($i=0; $i<$couponLength; $i++)
  484.         {
  485.             $couponCode .= $couponChars[rand(0,$couponCharLen)];
  486.         }
  487.         $check_coupon = $wpdb->get_var($wpdb->prepare('SELECT COUNT(id) FROM '.$table_phone_numbers.' WHERE Code = "'.$couponCode.'" LIMIT 1'));
  488.         if($check_coupon == 0)
  489.         {
  490.             $couponCheck = '1';
  491.         }
  492.     }
  493.     return $couponCode;
  494. }
  495.  
  496. function wbr_check_number_in_wbsms($email, $password, $phone_number, $url)
  497. {
  498.     $url = $url."/handle_curl_request.php";
  499.      
  500.     $data = array('email_address'=>$email,'password'=>$password,'phone_number'=>$phone_number,'action'=>'check_number');
  501.      
  502.     // makin curl request....
  503.     $ch = curl_init();
  504.     curl_setopt($ch, CURLOPT_URL,$url);
  505.     curl_setopt($ch, CURLOPT_POST, true);
  506.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);  
  507.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  508.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  509.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0');
  510.     $request = curl_exec($ch);
  511.     if($request == 'found')
  512.     {
  513.         return false;
  514.     }
  515.     else
  516.     {
  517.         return true;
  518.     }
  519.     curl_close($ch);
  520. }
  521.  
  522. function wbr_get_campaign_curl($email, $password, $url)
  523. {
  524.     $url = $url."/handle_curl_request.php";
  525.      
  526.     $data = array('email_address'=>$email,'password'=>$password,'action'=>'get_campaigns');
  527.      
  528.     // makin curl request....
  529.     $ch = curl_init();
  530.     curl_setopt($ch, CURLOPT_URL,$url);
  531.     curl_setopt($ch, CURLOPT_POST, true);
  532.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);  
  533.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  534.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  535.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0');
  536.     $request = curl_exec($ch);
  537.     $xml = simplexml_load_string($request);
  538.     return $xml;
  539.     curl_close($ch);
  540. }
  541.  
  542. function wbr_subscribe_in_campaign($wbsms_url,$from,$to,$body,$sms_sid,$message_sid)
  543. {
  544.     $url = $wbsms_url."/sms_controlling.php";
  545.     $hander_curl_url = $wbsms_url.'/handle_curl_request.php';
  546.  
  547.     $data_number = array('keyword'=>$body,'action'=>'get_campaign_number');
  548.  
  549.     $ch = curl_init();
  550.     curl_setopt($ch, CURLOPT_URL,$hander_curl_url);
  551.     curl_setopt($ch, CURLOPT_POST, true);
  552.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data_number);  
  553.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  554.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  555.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0');
  556. //============================================== PAYMENT ===================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement