ob_start(); require_once("config/functions.inc.php"); require_once("new/uploader.php"); if(isset($_POST['go'])) { $_SESSION['error']=array(); if(empty($_POST['name'])) $_SESSION['error']['name']="Required"; if(empty($_POST['father'])) $_SESSION['error']['father']="Required"; if(empty($_POST['mother'])) $_SESSION['error']['mother']="Required"; if(empty($_POST['gender'])) $_SESSION['error']['gender']="Required"; if(empty($_POST['dob'])) $_SESSION['error']['dob']="Required"; if(empty($_POST['address'])) $_SESSION['error']['address']="Required"; if(empty($_POST['program'])) $_SESSION['error']['program']="Required"; if(empty($_POST['courses'])) $_SESSION['error']['courses']="Required"; //$mm=mysqli_num_rows(mysqli_query($mysqli,"select * from members where contact='".$_POST['contact']."' and status!=2 order by id DESC limit 1")); $mm=mysqli_num_rows(mysqli_query($mysqli,"select * from members where contact='".$_POST['contact']."' order by id DESC limit 1")); //$emm=mysqli_num_rows(mysqli_query($mysqli,"select * from members where contact='".$_POST['contact']."' or email='".$_POST['email']."' and status!=2 order by id DESC limit 1")); $emm=mysqli_num_rows(mysqli_query($mysqli,"select * from members where contact='".$_POST['contact']."' or email='".$_POST['email']."' order by id DESC limit 1")); //if($mm!=0){ //$_SESSION['error']['contact']="Mobile Already Active Other Courese"; //} //if($mm!=0){ //$_SESSION['error']['email']="Email Already Active Other Courese"; //} if(empty($_POST['email'])) $_SESSION['error']['email']="Required"; if(empty($_POST['contact'])) $_SESSION['error']['contact']="Required"; if($_POST['contact']!=''){ if(is_numeric($_POST['contact'])){ if((strlen($_POST['contact'])!=10)) {$_SESSION['error']['contact']="10 Digits only";} } else{ $_SESSION['error']['contact']="Only Numeric Value";} } $sub=mysqli_fetch_array(mysqli_query($mysqli,"select * from courses where id='".$_POST['courses']."'")); $cau_code=$sub['code']; $fee=$sub['fees']-$_REQUEST['discount']; if($_POST['tax']!=''){ $tax=($fee*$TAX)/100; $fees=$fee+$tax; } else { $fees=$fee; } if(count($_SESSION['error'])==0) { $yer=date('Y', strtotime($_REQUEST['asession'])); $mon=date('M', strtotime($_REQUEST['doj'])); $newy=substr($yer,2,2); $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']."' ")); $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."001".$username; //$user=$bn."/".$newy."/".$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']; if(isset($_FILES['uploaded_file'])) { upload("new/images/user/"); if($finame!="") { $srcFile = "new/images/user/".$finame; }} 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']."',spouse='".$_POST['spouse']."',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-msg.php?regs=".enc($username)); } } ?>