Server IP : 2a02:4780:3:1493:0:3736:a38e:7 / Your IP : 216.73.216.139 Web Server : LiteSpeed System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64 User : u926327694 ( 926327694) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u926327694/domains/smsoft.in/public_html/auto-att/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php date_default_timezone_set('Asia/Kolkata'); if(isset($_GET['pwd'])) { if(base64_encode("Admin@123")==$_GET['pwd']) { if(Date('l')!='Sunday') { include"dbconnect.php"; $schoolcode = ''; if($con_main) { $sel_school = mysqli_query($con_main,"select * from schools where cron_is_active=1 and bio_machine_id != 0"); //$sel_school = mysqli_query($con_main,"select * from schools where schoolCode='demor'"); while($row_school = mysqli_fetch_array($sel_school)) { $school_id = $row_school['id']; $schoolcode = $row_school['schoolCode']; $absent_time = $row_school['absent_time']; $present_time = $row_school['present_time']; $school_code = $row_school['schoolCode']; $school_name = $row_school['schoolname']; $principal_no = $row_school['Cron_admin_num']; $main_username=$row_school['dbUsernameStudent']; $main_password=$row_school['dbPassword']; $main_dbname=$row_school['dbStudent']; $uhf_id=$row_school['bio_machine_id']; //for whatsapp $smsIsActiveWhatsapp = $row_school['smsIsActive_Teacher_whatsapp']; $smsIsActiveWhatsapp_stu = $row_school['smsIsActive_Student_whatsapp']; $whatsapp_api_key = $row_school['whatsapp_api_key']; $whatsapp_api_url = $row_school['whatsapp_api_url']; $whatsapp_instance_id = $row_school['whatsapp_instance_id']; $whatsapp_type = $row_school['whatsapp_type']; $smsId=$row_school['smsId']; $smsAPI=$row_school['smsAPI']; $smsURL=$row_school['smsURL']; $smsTempId=$row_school['smsTempIdAtten']; $smsIsActive=$row_school['smsIsActive_Teacher']; $smsIsActive_Stu=$row_school['smsIsActive_Student']; $sms_schoolname=$row_school['sms_schoolname']; $receiver_admin=$row_school['Bio_SMS']; $con = mysqli_connect("localhost",$main_username,$main_password,$main_dbname); mysqli_query($con,"CREATE TABLE sms_log (id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,S_id INT(11) NOT NULL,date Date NOT NULL,status VARCHAR(150))"); if($con) { $current_date = Date('Y-m-d'); $current_date_text = Date('d-m-Y'); $sel_holiday = mysqli_query($con,"select Holiday from master where Holiday = '$current_date'"); if(mysqli_num_rows($sel_holiday)>0) { $log = Date('d-m-Y H:i:s')." = Today is holiday in ".$school_name."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); exit; } else { // For Absent SMS if($absent_time!='00:00:00') { if(strtotime($absent_time)<time()) { $sql_total_absent=mysqli_query($con,"select * from student_registration as st where RFID != '' AND S_id not in(select S_id from attendence where Status='PRESENT' AND date='$current_date') AND S_id not in (select S_id from sms_log where date='$current_date' AND status='ABSENT')"); $sql_total_stu=mysqli_query($con,"select * from student_registration as st where RFID != ''"); if(mysqli_num_rows($sql_total_absent) == mysqli_num_rows($sql_total_stu)) { $log = Date('d-m-Y H:i:s')." = Cron run for ".$school_name." and skip cron for this school due to network issue\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); $sel_admin_alert = mysqli_query($con, "select S_id from sms_log where date='$current_date' AND status='Admin Alert' AND S_id=$school_id"); if(mysqli_num_rows($sel_admin_alert) == 0 || mysqli_num_rows($sel_admin_alert) == 1) { mysqli_query($con,"INSERT INTO sms_log(S_id,date,status) VALUES('$school_id','$current_date','Admin Alert')"); $message_wp = "We wanted to inform you that your bio data has not been updated due to the following reasons: \n\nToday is a holiday.\nThe SIM card has run out of credit.\nThe machine is not functioning properly.\nThank you for your understanding.\n\nSincerely,\n".$school_name; sendAttenWhatsapp($principal_no, $whatsapp_api_key, $whatsapp_api_url, $whatsapp_instance_id, $whatsapp_type, $message_wp); } } else { $day = Date('d'); $month = Date('m'); $year = Date('Y'); $cuur_time = Date('H:i:s'); $log = Date('d-m-Y H:i:s')." = Cron run for ".$school_name."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); $sql_absent=mysqli_query($con,"select * from student_registration as st where RFID != '' AND S_id not in(select S_id from attendence where Status='PRESENT' AND date='$current_date') AND S_id not in (select S_id from sms_log where date='$current_date' AND status='ABSENT')"); //$sql_absent=mysqli_query($con,"select * from student_registration as st where S_id in (1235,1775,1776,1777,1774)"); while($res_absent = mysqli_fetch_array($sql_absent)) { $receiver = $res_absent['Communication_number']; $S_id = $res_absent['S_id']; mysqli_query($con,"INSERT INTO `attendence`(`S_id`, `Class`, `Division`, `Subject`, `Roll_number`, `Name`, `Sex`, `Mobile`, `date`, `Status`, `DD`, `MM`, `YYYY`, `Nature_Student`, `IN_TIME`, `OUT_TIME`, `Att_Time`) select S_id,Class,Division,'Day',Roll_number,Name,Sex,Communication_number,'$current_date','ABSENT','$day','$month','$year',Nature_Student,'00:00:00','00:00:00','$cuur_time' from student_registration where S_id='$S_id'"); $is_active = $res_absent['Class']=="Teacher" ? $smsIsActive : $smsIsActive_Stu; if($is_active=="1" && strlen($receiver)=="10") { mysqli_query($con,"INSERT INTO sms_log(S_id,date,status) VALUES('$S_id','$current_date','ABSENT')"); if($schoolcode == 'HMBEG') { $current_date_text = "absent on ".$current_date_text; } sendAttensmsAbsent($res_absent['Name'],$current_date_text,$sms_schoolname,$receiver,$smsURL,$smsAPI,$smsId,$smsTempId,$schoolcode); } $is_active_whatsapp = $res_absent['Class']=="Teacher" ? $smsIsActiveWhatsapp : $smsIsActiveWhatsapp_stu; if($is_active_whatsapp=="1" && strlen($receiver)=="10") { $name_wp = $res_absent['Name']; mysqli_query($con,"INSERT INTO sms_log(S_id,date,status) VALUES('$S_id','$current_date','ABSENT')"); $message_wp = "Dear parent,\nkindly note your son/daughter ".$name_wp." is absent on ".$current_date_text ."\n Thank You $sms_schoolname."; if($res_absent['Class']=="Teacher") { $message_wp = "Dear ".$name_wp.",\nPlease be informed that you are absent on ".$current_date_text ."\n Thank You $sms_schoolname."; } sendAttenWhatsapp($receiver, $whatsapp_api_key, $whatsapp_api_url, $whatsapp_instance_id, $whatsapp_type, $message_wp); } } } } } else { $log = Date('d-m-Y H:i:s')." = Please set absent time in ".$school_name."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); } // For Present SMS // When present time not equle to 00:00:00 than check present time and present time is less than current time it will sent message /*if($present_time!='00:00:00') { if(strtotime($present_time)<time()) { $sql_absent=mysqli_query($con,"select * from attendence where Status='PRESENT' AND date='$current_date' AND S_id not in(select S_id from sms_log where date='$current_date' AND status='PRESENT')"); while($res_absent = mysqli_fetch_array($sql_absent)) { $receiver = $res_absent['Communication_number']; $S_id = $res_absent['S_id']; $AttendanceId = $res_absent['id']; $result_time11=mysqli_query($con,"select * from attendreports where AttendanceId=$AttendanceId"); $result_student1_123=mysqli_fetch_array($result_time11); $receiver = $res_absent['Mobile']; $time_in = $res_absent['IN_TIME']; $time_out = $res_absent['OUT_TIME']; $is_active = $res_absent['Class']=="Teacher" ? $smsIsActive : $smsIsActive_Stu; if($is_active=="1" && strlen($receiver)=="10") { mysqli_query($con,"INSERT INTO sms_log(S_id,date,status) VALUES('$S_id','$current_date','PRESENT')"); $time_in_new = Date('h:i a',strtotime($time_in)); $time_out_new = Date('h:i a',strtotime($time_out)); $bd=$current_date_text." ".$time_in_new." To ".$time_out_new; sendAttensmsPresent($res_absent['Name'],$bd,$sms_schoolname,$receiver,$smsURL,$smsAPI,$smsId,$smsTempId); } } } } else { $log = Date('d-m-Y H:i:s')." = Please set present time in ".$school_name."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); }*/ } } } } else { $log = Date('d-m-Y H:i:s')." = Connection failed"."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); exit; } } } else { $log = Date('d-m-Y H:i:s')." = Invalid cron job password"."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); exit; } } else { $log = Date('d-m-Y H:i:s')." = Plese enter cron job password"."\n"; file_put_contents('./cron_log.log', $log, FILE_APPEND); exit; } ?>