<?php 
session_start();
include 'dbc.php';



$userid=$_SESSION["userid"];
$today=date("d-m-Y");
$std_rollno=$_POST["std_rollno"];
$std_name=$_POST["std_name"];
$father_name=$_POST["father_name"];
$adate=$_POST["adate"];
$dob=$_POST["dob"];
$tmfee=$_POST["tmfee"];
$cons=$_POST["cons"];

$class_name=$_POST["class_name"];

$home_adress=$_POST["home_adress"];

$cell_1=$_POST["cell_1"];
$cell_2=$_POST["cell_2"];

$bal=$_POST["bal"];
$balbook=$_POST["balbook"];
$code=$_POST["code"];
$camp=$_POST["camp"];
$fno=$_POST["fno"];
$sec_fee=$_POST["sec_fee"];
$monthly_fee=$_POST["monthly_fee"];
$annual_fee=$_POST["annual_fee"];
$allied_code=$_POST["allied_code"];
$barcode=$_POST["barcode"];

$img_name=$barcode . "_" . $_FILES["app_file"]["name"];

move_uploaded_file($_FILES["app_file"]["tmp_name"],"app_images2/".$img_name);

  
   
   /*$sql4 = "select * from admission where fno = '$fno' and user_id='$userid'";
   $std_ledger14=mysql_query($sql4) or die("Error : " . mysql_error());

while($row4 = mysql_fetch_array($std_ledger14))
 
  {
 
 $std=$std + 1;
 
  }
   if ($std >= 1)
{
$sql1 = "select * from addclass where subname='$class_name' and user_id='$userid'";
   $std_ledger1=mysql_query($sql1) or die("Error : " . mysql_error());
   $app1=mysql_fetch_array($std_ledger1);
   $monthly_fee =$app1["fee"];
$mper =$monthly_fee * 25 / 100;
   $monthly_fee=$monthly_fee - $mper;
}
else
{
$sql12 = "select * from addclass where subname='$class_name' and user_id='$userid'";
   $std_ledger12=mysql_query($sql12) or die("Error : " . mysql_error());
   $app12=mysql_fetch_array($std_ledger12);
   $monthly_fee =$app12["fee"];
}
   */
   
$sql = "Insert into admission (id,date,std_rollno,std_name,father_name,dob,class_name,home_adress,cell_1,cell_2,monthly_fee,annual_fee,user_id,code,bal,camp,fno,allied_code,balbook,sec_fee,barcode,app_file,tmfee,cons) values (null,'$adate','$std_rollno','$std_name','$father_name','$dob','$class_name','$home_adress','$cell_1','$cell_2','$monthly_fee','$annual_fee','$userid','$code','$bal','$camp','$fno','$allied_code','$balbook','$sec_fee','$barcode','$img_name','$tmfee','$cons')";
mysql_query($sql) or die("Error : " . mysql_error());
$type = "xml"; 
$id = "rchalainsch"; 
$pass = "alain786"; 
$lang = "English"; 
$mask = "AlainSchool";                
// Data for text message 
$to = $cell_1; 
$message =  $std_name . ":Dear Parents: Thank you for visiting our prestigous institute Al Ain Cambridge Schools. Best wishes and good luck. Regards Al Ain Schools Cambridge"; 
$message1 =  $std_name . ":Dear Parents: Thank you for visiting our prestigous institute Al Ain Schools Cambridge. Best wishes and good luck. Regards Al Ain Schools Cambridge"; 
$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,'$today1','$my','$std_name','$message1','1','$userid','$to')";
mysql_query($sql16) or die("Error : " . mysql_error());

header("location:admission_form_raheem.php");
/*$sql="Select * from agents where userid='$user_id'";
$data=mysql_query($sql) or die ("Error:" . mysql_error());
$userdata=mysql_fetch_array($data);
$email=$userdata["e_mail"];
mail($email . ",info@lalburj.com","Candidate Information","Candidate Data Posted Successfully","Passport No:" . $app_pp_no . " of " . $app_name . "Has been Posted Successfully By:" . $_SESSION["userid"]);*/
?>
