query($sql);
ob_start();
session_start();
require ("signin.php");
if(isset($_SESSION['Register']))
{
if($_SESSION['Register'] == "Registered")
{
header('Location: index.php');
}
}
/*header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');*/
//==NEXT=
if(isset($_POST['next']))
{
$id = $_POST["ID_number"];
$name = $_POST["First_name"];
$lname = $_POST["Last_name"];
$sname = $_POST["Surname"];
//initials
$iname = substr($name,0,1);
$inameUp = strtoupper($iname);
$ilname = substr($lname,0,1);
$ilnameUp = strtoupper($ilname);
$isname1 = substr($sname,0,1);
$isname1Up = strtoupper($isname1);
$isname2 = substr($sname,1);
$isname2Low = strtolower($isname2);
$initials = "Initials :" . " " . $inameUp. "." . " " . $ilnameUp . "." . " " . $isname1Up . $isname2Low . "
";
//fullnames
$fname2 = substr($name,1);
$fname2Low = strtolower($fname2);
$flname2 = substr($lname,1);
$flname2Low = strtolower($flname2);
$fullnames = "First Name :" . " " . $inameUp . $fname2Low . "
" . "Second Name :" . " " . $ilnameUp . $flname2Low . "
" . "Surname :" . " " . $isname1Up . $isname2Low . "
";
$length = strlen($id);
$months = substr($id,2,2);
$password = $inameUp.$ilnameUp.$months;
$username = $months.$isname1Up.$isname2Low;
if ($length == 13 && $months > 0 && $months < 13)
{
//Date of birth
//get day
$day = substr($id,4,2);
if ($day <= 10)
{
$getday = "0" . $day . " ";
}
else
{
$getday = $day . " ";
}
//get month
//array
$month = array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$montha = array( 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12);
for ($i = 0; $i <12; $i++)
{
if($months == $montha[$i])
{
$getmongth = $month[$i] . " ";
}
}
//get year
$year = substr($id,0,2);
if ($year > 17 && $year <= 99)
{
$getyear = "19" . $year;
}
else if ($year < 18)
{
if ($year < 10)
{
$getyear = "200" . $year;
}
else
{
$getyear = "20" . $year;
}
}
//Age
//90's
if ($year > 17 && $year <= 99)
{
$age = 2017 - (1900 + $year);
if ($age <= 25)
{
$getage = "Age :" . " " . $age . "
";
}
else
{
$getage = "Your age does not allow you to create account as a learner." . "
" . "Age : " . $age . "
";
}
}
//2000's
else if ($year < 18)
{
$age = 2017 - (2000 + $year);
if($age>13)
{
$getage = "Age :" . " " . $age . "
";
}
else
{
$getage = "Your age does not allow you to create account as a learner." . "
" . "Age :" . " " . $age . "
";
}
}
//get gender
$output = substr($id,6,1);
if ($output >= 5)
{
$gender = "Male";
}
else
{
$gender = "Female";
}
//Citizenship
$citizen = substr($id,10,1);
if($citizen == 0)
{
$citizenship = "SA Citizen";
}
else
{
$citizenship = "Non SA Citizen";
}
}
else
{
$validity = "Invalid ID number!!!!";
}
//processing
if(isset($getday))
{
$exist = $con -> query ("SELECT * FROM learner where IDNumber = '$id'");
$result = $exist -> fetch_array(MYSQLI_BOTH);
if($result<1)
{
//to the database
$_SESSION["initials"] = $inameUp.$ilnameUp;
$_SESSION["name"] = $name;
$_SESSION["lname"] = $lname;
$_SESSION["sname"] = $sname;
$_SESSION["dob"] = $getday."/".$getmongth."/".$getyear;
$_SESSION["gender"] = $gender;
$_SESSION["ID_number"] = $_POST["ID_number"];
$_SESSION["Present_school"] = $_POST["Present_school"];
$_SESSION["Learners_address"] = $_POST["Learners_address"];
$_SESSION["citizenship"] = $citizenship;
$_SESSION["username"] = $username;
$_SESSION["password"] = $password;
$_SESSION["Home_Language"] = $_POST['Home_Language'];
$_SESSION["Mobile_number"] = $_POST["Mobile_number"];
$_SESSION["Relative"] = $_POST["rel_First_name"]."-".$_POST["rel_Surname"]."-".$_POST["grade_rel"]."-".$_POST["section_rel"];
$_SESSION['grade'] = $_POST['grade'];
$_SESSION['Email'] = $_POST['Email'];
//Inserting documents
$doc_name = "ID/Certeficate".$id;
$myfile = $_FILES['myfile']['name'];
$tmp_name = $_FILES['myfile']['tmp_name'];
if($myfile&&$doc_name)
{
$check = $con -> query("SELECT * FROM images WHERE username = '$username'");
$number = mysqli_num_rows($check);
if( $number < 1 && isset($_POST['next']))
{
$location = $myfile;
move_uploaded_file($tmp_name,"document/".$myfile);
$query = $con -> query("INSERT INTO images(imagename, imagepath,image,username,docname,doc,docpath) VALUES ('{$doc_name}', '{$location}', '{$tmp_name}','{$username}','','','')");
$_SESSION["doc_name"] = $doc_name;
$_SESSION["report"] = "Report".$id;
}
}
header('Location: Parent-details.php');
}
else
{
$errorid = "Your alreadey exist in the system";
}
}
}
?>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. printing and typesetting industry.
Sign Up