ok
Direktori : /home/gainstransformin/public_html/Gains_admin/cron_job/ |
Current File : /home/gainstransformin/public_html/Gains_admin/cron_job/demo.php |
<?php // Report all errors error_reporting(E_ALL); // Same as error_reporting(E_ALL); ini_set("error_reporting", E_ALL); ///////////////////////////////////////////////////////////////agriserach // define ('DOCUMENT_ROOT', '/home/ifgf/public_html/' ); // $dir = dirname(__FILE__); // require_once($dir.'/swift/swift_required.php'); $email="kiranc9911@gmail.com"; $DBUSER="flyctxya_gym_u"; $DBPASSWD="User@123@"; $DATABASE="flyctxya_gym_db"; mysql_connect("localhost","flyctxya_gym_u","User@123@"); mysql_select_db("flyctxya_gym_db"); // echo "SELECT mem_plan_id,mem_plan_expiry_date,fk_mem_id,mem_mobile_no // FROM membership_plan MP, member_registration MR // WHERE mem_plan_id IN ( // SELECT MAX(mem_plan_id) // FROM membership_plan // GROUP BY fk_mem_id // ) AND MP.fk_mem_id=MR.mem_id"; $qry=mysql_query("SELECT mem_plan_id,mem_plan_expiry_date,fk_mem_id,mem_mobile_no ,MR.fk_gym_id,gym_name,gym_id FROM membership_plan MP, member_registration MR, gym G WHERE mem_plan_id IN ( SELECT MAX(mem_plan_id) FROM membership_plan GROUP BY fk_mem_id ) AND MP.fk_mem_id=MR.mem_id AND MR.fk_gym_id=G.gym_id ") ; // $msg="Your membership plan will be expire tommarow." ; //$data=mysql_fetch_array(); if (mysql_num_rows($qry) > 0) { while ($accountUserData = mysql_fetch_array($qry)) { $qry11=mysql_query("select SUM(`sms_total`) as total_sent_sms FROM sms_log WHERE fk_gym_id='".$accountUserData['gym_id']."'"); $accountUserData1 = mysql_fetch_array($qry11); $qry1=mysql_query("select SUM(`sms_quatity`) as total_sms FROM sms_recharge WHERE fk_gym_id='".$accountUserData['gym_id']."'"); $accountUserData11 = mysql_fetch_array($qry1); if($accountUserData1['total_sent_sms'] >= $accountUserData11['total_sms']) { echo"Your SMS Plan Expire"; exit; } else { // echo $accountUserData['fk_gym_id']." "; // echo $accountUserData['mem_mobile_no']."<br>"; $msg="Your membership plan will be expire tommarow.Regards -".$accountUserData['gym_name'] ; $currenDate=date('Y-m-d'); $date1 = strtotime(date('Y-m-d'))."<br>"; $date2 = strtotime($accountUserData['mem_plan_expiry_date'])."<br>"; $days=($date2 - $date1)/60/60/24; $query1 = mysql_query("SELECT `gs_id`, `fk_gym_id`, `gs_user`, `gs_key`, `gs_senderid` FROM `gym_sms` WHERE fk_gym_id='".$accountUserData['fk_gym_id']."'"); $row1=mysql_fetch_array($query1); //echo "hiii".$row1['gs_user']; if($days==1) { $xml_data ='<?xml version="1.0"?> <parent><child><user>'.$row1['gs_user'].'</user><key>'.$row1['gs_key'].'</key> <mobile>'.$accountUserData['mem_mobile_no'].'</mobile> <message>'.$msg.'</message> <accusage>1</accusage><senderid >'.$row1['gs_senderid'].'</senderid> <unicode>0</unicode></child></parent>'; $URL="http://login.reliablefastsms.com/submitsms.jsp?"; $ch = curl_init($URL); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); echo" matvh"; $msg_total=strlen($msg); echo "<br>".$msg_total."<br>"; $part_msg=$msg_total/160; $final=ceil($part_msg); echo "<br>".$part_msg."<br>"; echo "<br>".$final; $qry2=mysql_query("insert into `sms_log`( `sms_log_mobile`, `sms_log_sms`, `sms_date`, `fk_gym_id`,`sms_total`) values ('".$accountUserData['mem_mobile_no']."','".$msg."','".$currenDate."','".$accountUserData['fk_gym_id']."','".$final."')"); } else { echo"not matvh"; } } } } ?>