[insert_php]
//require(‘mypage/index.php’);
//connect and chk details
$con = mysqli_connect(“localhost”, “conooorg_saly”, “{{Ssgkk4}}”) or die(“Technical Error – 1001”);
$db = mysqli_select_db($con, “conooorg_nursing”);
if(!isset($_POST[‘pin’]) && !isset($_POST[‘ok’]) && !isset($_POST[’email’]) && !isset($_POST[‘next2’]))
{
echo “To complete your registration please ensure that your PIN is activated, if you don’t have a PIN yet click here“;
verifypin();
} elseif(isset($_POST[‘completereg’]) && isset($_POST[‘pin’])) {
//upload passport
$pin = $_POST[‘pin’];
$pinpassport = str_replace(“/”, “”, $pin);
$newfile_name = “passport/”.$pinpassport.”.jpg”;
move_uploaded_file($_FILES[‘passport’][‘tmp_name’], $newfile_name);
//save result
//1st sitting
$exam1 = $_POST[‘exam1’]; //type
$exam1no = $_POST[‘exam1no’]; //no
$exam1date = $_POST[‘exam1date’]; //date
$examcenter = $_POST[‘examcenter’]; //center
$exam1pin = $_POST[‘exam1pin’]; //pin result checker
$exam1serialno = $_POST[‘exam1serialno’]; //pin result checker
$eng1 = $_POST[‘eng1’];
$mat1 = $_POST[‘mat1’];
$bio1 = $_POST[‘bio1’];
$che1 = $_POST[‘che1’];
$phy1 = $_POST[‘phy1’];
$sub1 = $_POST[‘OneSub1’].”: “.$_POST[‘OneSub1value’];
$sub2 = $_POST[‘OneSub2’].”: “.$_POST[‘OneSub2value’];
$sub3 = $_POST[‘OneSub3’].”: “.$_POST[‘OneSub3value’];
$sub4 = $_POST[‘OneSub4’].”: “.$_POST[‘OneSub4value’];
$r = mysqli_query($con, “update result set examtype = ‘$exam1’, date = ‘$exam1date’, examno = ‘$exam1no’, examcenter = ‘$examcenter’, exam1serialno=’$exam1serialno’, exam1pin=’$exam1pin’, English = ‘$eng1’, Mathematics = ‘$mat1’, Biology = ‘$bio1’, Chemistry = ‘$che1’, Physics = ‘$phy1’, othersubject1 = ‘$sub1’, othersubject2 = ‘$sub2’, othersubject3 = ‘$sub3’, othersubject4 = ‘$sub4’ where pin=’$pin'”);
//2nd sitting
$exam2 = $_POST[‘exam2’]; //type
$exam2no = $_POST[‘exam2no’]; //no
$exam2date = $_POST[‘exam2date’]; //date
$exam2center = $_POST[‘exam2center’]; //center
$exam2pin = $_POST[‘exam2pin’]; //pin result checker
$exam2serialno = $_POST[‘exam2serialno’]; //pin result checker
$eng2 = $_POST[‘eng2’];
$mat2 = $_POST[‘mat2’];
$bio2 = $_POST[‘bio2’];
$che2 = $_POST[‘che2’];
$phy2 = $_POST[‘phy2’];
$sub1b = $_POST[‘OneSub1b’].”: “.$_POST[‘OneSub1bvalue’];
$sub2b = $_POST[‘OneSub2b’].”: “.$_POST[‘OneSub2bvalue’];
$sub3b = $_POST[‘OneSub3b’].”: “.$_POST[‘OneSub3bvalue’];
$sub4b = $_POST[‘OneSub4b’].”: “.$_POST[‘OneSub4bvalue’];
$r = mysqli_query($con, “update result set examtype2 = ‘$exam2’, date2 = ‘$exam2date’, examno2 = ‘$exam2no’, examcenter2 = ‘$exam2center’, exam2serialno=’$exam2serialno’, exam2pin=’$exam2pin’, English2 = ‘$eng2’, Mathematics2 = ‘$mat2’, Biology2 = ‘$bio2’, Chemistry2 = ‘$che2’, Physics2 = ‘$phy2’, othersubjectb1 = ‘$sub1b’, othersubjectb2 = ‘$sub2b’, othersubjectb3 = ‘$sub3b’, othersubjectb4 = ‘$sub4b’ where pin=’$pin'”);
echo “
CONGRATULATIONS
You have completed your registration.”;echo “
“;
if(!$r){ echo mysqli_error($con); }
} elseif(isset($_POST[‘next2’]) && isset($_POST[‘sponsor’])) {
//submit next of kin and sponsor
$email = $_POST[’email’];
$pin = $_POST[‘pin’];
//sponsor
$sponsorname = $_POST[‘sponsor’];
$sponsoraddress = $_POST[‘sponsoraddress’];
$sponsorphone = $_POST[‘sponsorphone’];
//nok
$nokname = $_POST[‘nokname’];
$nokaddress = $_POST[‘nokaddress’];
$nokphone = $_POST[‘nokphone’];
$nokrelationship = $_POST[‘nokrelationship’];
//sch attended
$school1 = $_POST[‘school1date’].” “.$_POST[‘school1’];
$school2 = $_POST[‘school2date’].” “.$_POST[‘school2’];
$school3 = $_POST[‘school3date’].” “.$_POST[‘school3’];
$r = mysqli_query($con, “update studentdata set sponsorname = ‘$sponsorname’, sponsoraddress = ‘$sponsoraddress’, sponsorphone = ‘$sponsorphone’, nokname = ‘$nokname’, nokaddress = ‘$nokaddress’, nokphone = ‘$nokphone’, nokrelationship = ‘$nokrelationship’, schattended1=’$school1′, schattended2=’$school2′, schattended3=’$school3′, status=’1′ where email=’$email'”);
if($r)
{
echo “
Final Step
“;
echo “
“;
} else { echo “Sponsor/Next of Kin details not saved please, try again with valid details”.mysqli_error($con); }
//display cert upload
} elseif(isset($_POST[‘next’]) && isset($_POST[’email’])) {
//next – save form
$email = $_POST[’email’];
$pin = $_POST[‘pin’];
$dob = $_POST[‘d’].”/”.$_POST[‘m’].”/”.$_POST[‘y’];
$religion = $_POST[‘religion’];
$maritalstatus = $_POST[‘maritalstatus’];
$state = $_POST[‘state’];
$lga = $_POST[‘lga’];
$sex = $_POST[‘sex’];
$homeaddress = $_POST[‘homeaddress’];
$postaladdress = $_POST[‘postaladdress’];
$r = mysqli_query($con, “update studentdata set dob = ‘$dob’, religion = ‘$religion’, maritalstatus = ‘$maritalstatus’, state = ‘$state’, lga = ‘$lga’, sex = ‘$sex’, permanentaddress = ‘$homeaddress’, postaladdress = ‘$postaladdress’ where email=’$email’ and pin=’$pin'”);
if($r)
{
//display sponsor and next of kin form
echo “
You are almost done.
“;
} else { echo mysqli_error($con); }
} elseif(!isset($_POST[’email’]) && isset($_POST[‘pin’]) ) {
//check pin
$pin = $_POST[‘pin’];
$password = sha1($_POST[‘password’]);
$r = mysqli_query($con, “select * from pin where pin=’$pin’ LIMIT 1”);
$x = mysqli_num_rows($r);
if($x == 0)
{
//not found
echo “Sorry, this PIN does not exist“;
verifypin();
} else {
//PIN correct
//get other details
$row = mysqli_fetch_array($r);
$cpass = $row[‘password’];
$status = $row[‘status’];
//check payment status
if($status == “Not Activated”)
{
echo “
Your PIN $pin has not been activated
“;
echo “Please make payment to activate your PIN, If you have paid please exercise patient.
“;
echo “If you have made payment for over 24hours and this continues, please contact our technical team.”;
verifypin();
} elseif ($status == “Block”) {
echo “
Your PIN $pin has been BLOCKED
“;
echo “This is unusual but if you get this message please report to the school or contact our technical team for some clarification.”;
verifypin();
} else {
//check password
if($cpass == $password)
{
//password is correct
$surname = $row[‘surname’];
$middlename = $row[‘middlename’];
$firstname = $row[‘firstname’];
$email = $row[’email’];
$studentname = $surname.” “.$middlename.” “.$firstname;
echo “
WELCOME BACK “.strtoupper($studentname);
form2($con, $email, $surname, $middlename, $firstname, $pin);
}else{
//password not correct
echo “Sorry, your password is incorrect“;
verifypin();
//echo “Forgot Password“;
}
} //payment check end
} //x val end
}
function verifypin(){
echo “
“;
}
function form2($con, $email, $surname, $middlename, $firstname, $pin)
{
echo “
“;
}
[/insert_php]