<?php // Configuration variables
session_start();
include 'dbc.php';
date_default_timezone_set("Asia/Karachi");

$userid=$_SESSION["userid"];
$complain=$_POST["complain"];
$today=$_POST["today"];
$sql = "select * from atten where obt_mark='A'  and date = '$today' and user_id='$userid'";
$admission=mysql_query($sql) or die("Error : " . mysql_error());
    
while($test=mysql_fetch_array($admission))
{
 $std_name=$test['std_name'] ;
				$std_rollno= $test['std_rollno'] ;					
				$father_name=$test['father_name'] ;
				$class_name=$test['class_name'] ;
				$cell_1=$test['cell_1'] ;
				$bal=$test['bal'] ;
	$type = "xml"; 
$id = "rchalainsch"; 
$pass = "alain786"; 
$lang = "English"; 
$mask = "AlainSchool";    
// Data for text message 
$to = $cell_1; 
$message = "Dear Parents:" . $std_name . ": Your Child is Absent Today."; 
$message1 =  $message;
$message = urlencode($message);   
// Prepare data for POST request 
$data = "id=".$id."&pass=".$pass."&msg=".$message."&to=".$to."&lang=".$lang."&mask=".$mask."&type=".$type;   
// Send the POST request with cURL 
$ch = curl_init('http://www.outreach.pk/api/sendsms.php/sendsms/url'); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$result = curl_exec($ch); 
//This is the result from Outreach 

curl_close($ch); 
	
$sql16 = "Insert into notice (id,date,month_name,sname,notice,total,user_id,cell_1) values (null,'$today','$month_name','$std_name','$message1','1','$userid','$to')";
mysql_query($sql16) or die("Error : " . mysql_error());

	 }
	echo "Message Send";

 

?> 
<a href="send_sms_absent.php">Back</a>