ob_start();
require_once("config/functions.inc.php");
require_once("new/uploader.php");
if(isset($_POST['go']))
{
$_SESSION['error']=array();
$sub=mysqli_fetch_array(mysqli_query($mysqli,"select * from courses where id='".$_POST['courses']."'"));
$fee=$sub['fees']-$_REQUEST['discount'];
if($_POST['tax']!=''){
$tax=($fee*$TAX)/100;
$fees=$fee+$tax;
}
else
{
$fees=$fee;
}
if(count($_SESSION['error'])==0)
{
$rec=mysqli_fetch_array(mysqli_query($mysqli,"select * from members order by id DESC limit 1"));
$branch=mysqli_fetch_array(mysqli_query($mysqli,"select * from branch where id='".$_POST['branch']."' "));
$dated=date('d', strtotime($_REQUEST['doj']));
$yer=date('Y', strtotime($_REQUEST['doj']));
$mon=date('m', strtotime($_REQUEST['doj']));
$newy=substr($yer,2,2);
$num = $rec['username']+1;
$str_length = 6;
// hardcoded left padding if number < $str_length
$str = substr("0000000{$num}", -$str_length);
$username=$num;
$bn=$branch['bcode'];
$user=$bn.$yer."1000".$username;
$password=$_REQUEST['contact'];
$otp=rand(10000,99999);
$current_date=date("Y-m-d");
$srcFile = "new/images/user/".$finame;
$cau=mysqli_fetch_array(mysqli_query($mysqli,"select * from courses where id='".$_REQUEST['courses']."'"));
$cfee=$cau['cfee'];
mysqli_query($mysqli,"insert into members set adminfee='$cfee',username='".$username."',regsno='".$user."',password='".$otp."',name='".ucwords($_POST['name'])."',gender='".$_POST['gender']."',asession='".$_POST['asession']."',idnumber='".$_POST['idnumber']."',identity_type='".$_POST['identity_type']."',dob='".$_POST['dob']."',category='".$_POST['category']."',father='".ucwords($_POST['father'])."',mother='".ucwords($_POST['mother'])."',contact='".$_POST['contact']."',fcontact='".$_POST['fcontact']."',program='".$_POST['program']."',courses='".$_POST['courses']."',qui='".$_POST['qui']."',address='".$_POST['address']."',email='".$_POST['email']."',doj='".$current_date."',fee='".$fees."',discount='".$_POST['discount']."',tax='".$_POST['tax']."',enquiry_source='".$_POST['enquiry_source']."',religion='".$_POST['religion']."',marital='".$_POST['marital']."',
state='".$_POST['state']."',district='".$_POST['district']."',other='".$_POST['other']."',refer='".dec($_POST['refer'])."',pincode='".$_POST['pincode']."',type='2',photo='$finame',branch='".$_POST['branch']."', otp='".$otp."',status=0,uid='1'") or die(mysqli_error($mysqli));
$email=$_POST['email'];
include("msg1.php");
$EMAIL=$EMAIL_ID;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $SITE_NAME <$EMAIL>\r\n";
mail($email,'Student Registration',$msg, $headers);
$_SESSION['sess_msg']="Record Saved...";
$mob=urlencode($_REQUEST['contact']);
$sendsms = "DEAR ".$pre." ".strtoupper($_POST['name'])." Welcome to ".$SITE_NAME.", Your otp is ".$otp." & Reg. NO. is ".$user." - Password is ".$otp." Login to ".$SITE_URL." ";
$sms=urlencode($sendsms);
//$url="http://nimbusit.biz/api/SmsApi/SendSingleApi?UserID=HBCESKILL&Password=HBCE2020SD&SenderID=HBCESD&Phno=$mob&Msg=$sms&EntityID=1201159195203498217";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
$curl_scraped_page;
header("Location:thanks.php?regs=".enc($username));
}
}
?>