Your IP : 10.1.73.149


Current Path : /home/bolconlineco/public_html/coordinator/
Upload File :
Current File : /home/bolconlineco/public_html/coordinator/inc.php

<?php
if(isset($_GET['msg'])){ ?>

    <span class="error">Assignment Assign Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";
}


if(isset($_GET['task'])){ ?>

    <span class="error">Tasks Inserted Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-5';\",2500);</script>";
}

if(isset($_GET['nv'])){ ?>

    <span class="error">Please Select A Vaid Type of File</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-12';\",2500);</script>";
}


if(isset($_GET['de']))
{
    ?>
    <span class="error">Deleted Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-12';\",2500);</script>";
}

if(isset($_GET['vn'])) { ?>

    <span class="error">Uploaded Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-12';\",2500);</script>";

}

if(isset($_GET['a']))
{
    ?>
    <span class="error">Assignment Re-Assign Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";
}

?>
<?php
if(isset($_GET['fe']))
{
    ?>
    <span class="error">Fee Added Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-8';\",2500);</script>";
}

?>
<?php
if(isset($_GET['assign']))
{
    ?>
    <span class="error"> Uploaded Successfully</span>

    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";

}

?>
<?php
if(isset($_GET['err']))
{
    ?>
    <span class="error">Please Enter Due Date</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}

?>
<?php
if(isset($_GET['e']))
{
    ?>
    <span class="error">This Email is already registerd</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id';\",2500);</script>";


}

?>
<?php
if(isset($_GET['up']))
{
    ?>
    <span class="error">Result Re-Uploaded Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}

?>
<?php
if(isset($_GET['er']))
{
    ?>
    <span class="error">Please Select a Valid type</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}
?>
<?php
if(isset($_GET['n']))
{
    ?>
    <span class="error">No Assignment Founds</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}
?>
<?php
if(isset($_GET['af']))
{
    ?>
    <span class="error"> Inserted Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-8';\",2500);</script>";


}
?>
<?php
if(isset($_GET['uf']))
{
    ?>
    <span class="error"> Update Successfully</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-8';\",2500);</script>";


}
?>

<?php
// start of tutor change
if(isset($_GET['ter']))
{
    ?>
    <span class="error">No Tutor Selected</span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}
?>
<?php
if(isset($_GET['tas']))
{
    ?>
    <span class="error">Tutor Updated Successfully </span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id#ui-tabs-3';\",2500);</script>";


}
// end of tutor change code
?>

<?php
if(isset($_GET['csuccss']))
{
    ?>
    <span class="error">Password Change Successfully </span>
    <?php
    echo "<script>setTimeout(\"location.href = 'studentInfo.php?Id=$id';\",2500);</script>";


}
// end of tutor change code
?>


<?php
$query="SELECT * FROM student where rollno='$id'";
$reslt=mysql_query($query) or die(mysql_error());
$fetch=mysql_fetch_array($reslt);
extract($fetch);
$query2="select * from course where courseId=(select courseid from assigncourse where rollno='$rollno')";
$rr=mysql_query($query2) or die(mysql_error());
$resultSEt=mysql_fetch_array($rr);
?>
<?php
if(isset($_POST['registrationdate']))
{
    //$newRegist=date('Y-m-d',strtotime($_POST['registdate']));
    //$old=sql_strip($_POST['oldregist']);
    $day=$_POST['day'];
    $month=$_POST['month'];
    $year=$_POST['year'];
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Registeration date of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    $newRegist=$year.'-'.$month.'-'.$day;
    $query="update student set registrationdate='$newRegist' where  rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    // header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}

elseif(isset($_POST['postcodeupdate']))
{
    $postcodes=sql_strip($_POST['postcodes']);
    $oldrepostcode=sql_strip($_POST['oldrepostcode']);
    $query="update student set postcode='$postcodes' where postcode='$oldrepostcode' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Postcode of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    // header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatefname']))
{
    $firstname=$_POST['firstname'];
    $oldfname=$_POST['oldfname'];
    $query="update student set fname='$firstname' where fname='$oldfname' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Firstname of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}else if(isset($_POST['updatetitle']))
{
    $title = !empty($_POST['titles'])?$_POST['titles']:$_POST['title'];

    if($title==3)
    {
        $title=sql_strip($_POST['title']);
    }

    $query="update student set title='$title' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatelname']))
{
    $lastname=$_POST['lastname'];
    $oldlname=$_POST['oldlname'];
    $query="update student set lname='$lastname' where lname='$oldlname' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Lastname of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}

elseif(isset($_POST['updatedob']))
{
    //$newdob=date('d/m/Y',strtotime($_POST['newdob']));
    //$olddob=date('d/m/Y',strtotime($_POST['olddob']));
    $month=$_POST['month'];
    $day=$_POST['day'];
    $year=$_POST['year'];
    $newdob=$year.'-'.$month.'-'.$day;
    $query="update student set dob='$newdob' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the date of birth of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updateaddress1']))
{
    $newaddress1=$_POST['newaddress1'];
    $oldaddress1=$_POST['oldaddress1'];

    $query="update student set address='$newaddress1' where address='$oldaddress1' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 1 of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);

    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updateaddress2']))
{
    $newaddress2=$_POST['newaddress2'];

    $query="update student set address2='$newaddress2' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 2 of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updateaddress3']))
{
    $newaddress3=$_POST['newaddress3'];

    $query="update student set address3='$newaddress3' where  rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 3 of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatecity']))
{
    $newcity=$_POST['newcity'];
    $oldcity=$_POST['oldcity'];
    $query="update student set city='$newcity' where city='$oldcity' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the City of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatecountry']))
{
    $newcountry=$_POST['newcountry'];
    //$oldlname=$_POST['oldlname'];
    $query="update student set country='$newcountry' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Country of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatephone']))
{
    $phone=$_POST['phone'];
    $query="update student set phone='$phone' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Phone number of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatemobile']))
{
    $mobile=$_POST['mobile'];
    $query="update student set mobile='$mobile' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Mobile number of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
}
elseif(isset($_POST['updatest']))
{
    $studstatus=$_POST['studstatus'];
    if($studstatus==3)
    {
        $dat=$_POST['titles'];
        $query="update student set studentstatus='$studstatus',comp_date='".date('Y-m-d')."' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());

        $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the status of role number ".$id."','".date('Y-m-d H:i:s')."')";
        mysql_query($maintainLogs);
        // header("location:studentInfo.php?Id=$id");
        //exit();
        echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
    }
    else
    {

        $query="update student set studentstatus='$studstatus' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the status of role number ".$id."','".date('Y-m-d H:i:s')."')";
        mysql_query($maintainLogs);
        // header("location:studentInfo.php?Id=$id");
        //exit();
        echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
    }

} elseif(isset($_POST['update_admission_source'])) {

    $admission_source = $_POST['admission_source'];

        $query="update student set admission_source='$admission_source' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the admission source of role number ".$id."','".date('Y-m-d H:i:s')."')";
        mysql_query($maintainLogs);
        // header("location:studentInfo.php?Id=$id");
        //exit();
        echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";

} elseif(isset($_POST['update_stage'])) {

	$stage = $_POST['stage'];

	$query="update student set stage='$stage' where rollno='$id'";
	$result=mysql_query($query) or die(mysql_error());
	$maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the admission source of role number ".$id."','".date('Y-m-d H:i:s')."')";
	mysql_query($maintainLogs);
	// header("location:studentInfo.php?Id=$id");
	//exit();
	echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";

}


elseif(isset($_POST['updateemail']))
{
    $email=$_POST['newemail'];
    $oldemail=$_POST['oldemail'];
    if($email==$oldemail)
    {
        echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
    }else
    {
        $sql="select * from programe_co where email='$email'";
        $rresult=mysql_query($sql) or die(mysql_error());
        $sql1="select tutorId from tutor where email='$email'";
        $rr=mysql_query($sql1) or die(mysql_error());
        $sql="select SId from student where email='$email'";
        $result=mysql_query($sql) or die(mysql_error());
        if(mysql_num_rows($rresult) > 0 )
        {
            echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
        }else if(mysql_num_rows($rr) > 0 )
        {
            echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
        }else if(mysql_num_rows($result) > 0 )
        {
            echo "<script>window.location.href='studentInfo.php?e&Id=$id'</script>";
        }else
        {
            $oldemail=$_POST['oldemail'];
            $query="update student set email='$email' where rollno='$id'";
            $result=mysql_query($query) or die(mysql_error());
            $qq="update admin set username='$email' where username='$oldemail'";
            $rr=mysql_query($qq) or die(mysql_error());
            //header("location:studentInfo.php?Id=$id");
            //exit();
            echo "<script>window.location.href='studentInfo.php?Id=$id'</script>";
        }
    }
}else if(isset($_POST['updatepass']))
{
    $passemail=$_POST['passemail'];
    $newpass=md5($_POST['newpass']);
    $passquery="update admin set userPass='$newpass' where username='$passemail'";
    $headers = "";

    $str="";

    $headers .= "Content-type: text/html; charset=iso-8859-1\n";

    $headers .= 'From:admissions@bolc.co.uk' . "\r\n";

    $subject = "Result uploaded";

    $str.="Your Password Change";

    $str.="Your New Password:".$_POST['newpass'];

    $message = "<html><body>".$str."</body></html>";


    mail($passemail, $subject, $message, $headers,"-f".$email);

    mysql_query($passquery)or die(mysql_error());


    echo "<script>window.location.href='studentInfo.php?Id=$id&csuccss'</script>";

}
elseif(isset($_POST['updatetitle']))
{
    $title=$_POST['title'];
    $query="update student set jobtitle='$title' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Job Title of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";
}

elseif(isset($_POST['updatecomp']))
{
    $companyname=$_POST['companyname'];
    $query="update student set companyname='$companyname' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Company of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    // header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";

}
elseif(isset($_POST['upadd1']))
{
    $addline1=$_POST['addline1'];
    $query="update student set addressline1='$addline1' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 1 (Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";
}

elseif(isset($_POST['updateaddressline2']))
{
    $addressline2=$_POST['addressline2'];
    $query="update student set addressline2='$addressline2' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 2 (Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";
}
elseif(isset($_POST['updateaddressline3']))
{
    $addressline3=$_POST['addressline3'];
    $query="update student set addressline3='$addressline3' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Address Line 3(Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    // header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";

}
elseif(isset($_POST['updatee-City']))
{
    $ecity=$_POST['ecity'];
    $query="update student set ecity='$ecity' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the City (Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";

}
elseif(isset($_POST['epostcode']))
{
    $ecode=$_POST['ecode'];
    $query="update student set epostcode='$ecode' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());

    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Postcode (Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    //header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";

}
elseif(isset($_POST['updatemecountry']))
{
    $ecountry=$_POST['ecountry'];
    $query="update student set ecountry='$ecountry' where rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."','Updated the Country (Employment) of role number ".$id."','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    // header("location:studentInfo.php?Id=$id");
    //exit();
    echo "<script>window.location.href='studentInfo.php?Id=$id'#ui-tabs-9</script>";

}

if(isset($_POST['submitthis']))
{

    $topicId=$_POST['topicIdd'];
    $courseId=$_POST['courseIdd'];
    //$assigndate=$_POST['assigndate'];
    //$submit=explode('/',$assigndate);
    //$submitted=$submit[2].'-'.$submit[1].'-'.$submit[0];

    //if(empty($assigndate))
    //{
    //header("location:studentInfo.php?Id=$id&err#ui-tabs-3");
    //}
    //else
    //{
    $q="SELECT tAId FROM topicassignment where topicId='$topicId' and courseId='$courseId'";
    $r=mysql_query($q) or die(mysql_error());
    if(mysql_num_rows($r) >= 0)
    {
        $fff=mysql_fetch_array($r);
        $taIdFound = $fff['tAId'];

        $sql1="insert into studentassignment (AssignmentName, issuedate, AssignmentStatus, rollno, courseId, topicId, student, teacher)
    values('$taIdFound',CURDATE(),1,'$id','$courseId','$topicId',1,0)";
        $result=mysql_query($sql1) or die(mysql_error());
        if($result) {

            header("location:studentInfo.php?Id=$id&msg#ui-tabs-3");
            exit();


        }

    }else
    {
        header("location:studentInfo.php?Id=$id&n#ui-tabs-3");
        exit();
    }




    //}
}

if(isset($_POST['addtasks']))
{
    $taks=$_POST['task'];

    $date1=$_POST['taskdate'];
    $d1=explode('/',$date1);
    $date=$d1[2].'-'.$d1[1].'-'.$d1[0];
    $assignedto = $_POST['assgined_task_to'];
    $query="insert into tasks values ('','$taks','$date',now(),2,'$id','$assignedto',0)";
    $result=mysql_query($query) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."',' Added a new Task ','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    header("location:studentInfo.php?Id=$id&task#ui-tabs-5");
    exit();
}

if(isset($_POST['updatetask']))
{
    $task=$_POST['task'];
    $date1= $_POST['date'];
    $d1=explode('/',$date1);
    $date=$d1[2].'-'.$d1[1].'-'.$d1[0];
    $idd=$_POST['id'];
    $q="update tasks set task='$task',taskdate='$date',cdate=now() where id='$idd' and rollno='$id'";
    $r=mysql_query($q) or die(mysql_error());
    $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$co_id."','".$fullname."','".$_SESSION['coordinatorrole']."',' Updated a Task ','".date('Y-m-d H:i:s')."')";
    mysql_query($maintainLogs);
    header("location:studentInfo.php?Id=$id#ui-tabs-5");
    exit();
}

if(isset($_GET['d']))
{

    $tasks=$_GET['taskId'];
    $sql = "update tasks set taskstatus = 15  where id='$tasks'";
    $d=mysql_query($sql);
    header("location:studentInfo.php?Id=$id#ui-tabs-5");
    exit();

}
?>
<?php
if(isset($_POST['add-upload']))
{

    $name = $_FILES['upload']['name'];

    $temp_name = $_FILES['upload']['tmp_name'];

    $allowed = array('doc','docx','pdf');

    $type = pathinfo($name,PATHINFO_EXTENSION);

    echo  $iid= (int)$_POST['assigid'];

    $dir="../studentresult/";
    $rand = rand(10, 100);
    $fullname=$rand.$name;

    if(in_array($type,$allowed)) {

        $q1="SELECT * from studentassignment where SAid='$iid' and rollno='$id' and AssignmentStatus=3";
        $r=mysql_query($q1) or die(mysql_error());

        if(mysql_num_rows($r) > 0) {

            if(move_uploaded_file($temp_name,$dir.$fullname)) {

                $query2="SELECT * from studentassignment where SAid='$iid' and rollno='$id'";

                $reuslt2=mysql_query($query2) or die(mysql_error());

                $aN=mysql_fetch_array($reuslt2);

                $aname=$aN['AssignmentName'];
                $sql="update uploadassignment set uploadStatus=0,Reassign=0 where assignmentId='$iid' and courseId=".$aN['courseId']."  and topicId=".$aN['topicId']." and rollno='$id'";

                $result=mysql_query($sql) or die(mysql_error());

                $qq2="SELECT fullname from studenresult where assignmentId='$aname' and rollno='$id'";
                $resuletSet=mysql_query($qq2) or die(mysql_error());
                $name=mysql_fetch_array($resuletSet);
                if(file_exists('../studentresult/'.$name['fullname']))
                {
                    unlink('../studentresult/'.$name['fullname']);
                }
                $update_date=date('Y-m-d');
                $q = "update studenresult set fullname='$fullname',uploaddate='$update_date' where assignmentId='$aname' and rollno='$id'";

                mysql_query($q) or die(mysql_error());

                $headers="";

                $str="";

                $headers .= "Content-type: text/html; charset=iso-8859-1\n";

                $headers .= 'From:admissions@bolc.co.uk' . "\r\n";

                $subject = "Result uploaded";

                $str.="Result uploaded log on to your account to view your result";

                $message = "<html><body>".$str."</body></html>";


                mail($email, $subject, $message, $headers,"-f".$email);

                header("location:studentInfo.php?Id=$id&up#ui-tabs-3");

                exit();
            }

        }else
        {


            if(move_uploaded_file($temp_name,$dir.$fullname))

            {

                $query="update studentassignment set AssignmentStatus=3 where SAid='$iid' and rollno='$id'";

                $result=mysql_query($query) or die(mysql_error());

                $query2="SELECT * from studentassignment where SAid='$iid' and rollno='$id'";

                $reuslt2=mysql_query($query2) or die(mysql_error());

                $aN=mysql_fetch_array($reuslt2);

                $aname=$aN['AssignmentName'];
                $update_date=date('Y-m-d');
                $result1=mysql_query("select * from studenresult where assignmentId='$aname' and rollno='$id'") or die(mysql_error());
                if(mysql_num_rows($result1)>0)
                {
                    $fetch=mysql_fetch_array($result1);
                    unlink('../studenresult/'.$fetch['fullname']);
                    if (mysql_num_rows(mysql_query("SELECT * FROM uploadassignment where assignmentId='$iid' and courseId=".$aN['courseId']."  and topicId=".$aN['topicId']." and rollno='$id'"))) {
                        $sql="update uploadassignment set uploadStatus=0,Reassign=0 where assignmentId='$iid' and courseId=".$aN['courseId']."  and topicId=".$aN['topicId']." and rollno='$id'";
                    } else {
                        $temp_row = mysql_fetch_array(mysql_query("SELECT tutorId FROM assigncourse WHERE courseid = " . $aN['courseId'] . " AND rollno = $id"));
                        $sql="insert into uploadassignment set uploadStatus=0,Reassign=0, assignmentId='$iid', courseId=".$aN['courseId'].", topicId=".$aN['topicId'].", rollno='$id', tutorId = " . $temp_row['tutorId'] . ", fullname = '$fullname', uploaddate = '" . date('Y-m-d') . "'";
                    }
                    mysql_query($sql) or die(mysql_error());
                    $qqq=mysql_query("update studenresult set fullname='$fullname',uploaddate='$update_date' where assignmentId='$aname' and rollno='$id'");
                    header("location:studentInfo.php?Id=$id&assign#ui-tabs-3");
                    exit();
                }else
                {

                    $update_date=date('Y-m-d');
                    $query3="insert into studenresult (assignmentId, rollno, fullname, uploaddate) values ('$aname','$id','$fullname','$update_date')";

                    $result=mysql_query($query3) or die(mysql_error());

                    $sql="update uploadassignment set uploadStatus=0,Reassign=0 where assignmentId='$iid' and courseId=".$aN['courseId']."  and topicId=".$aN['topicId']." and rollno='$id'";

                    $result=mysql_query($sql) or die(mysql_error());

                    header("location:studentInfo.php?Id=$id&assign#ui-tabs-3");

                    exit();

                }
            }
        }

    }else
    {

        header("location:studentInfo.php?Id=$id&er#ui-tabs-3");
        exit();



    }

}


if(isset($_POST['Re-Assign'])) {
    $courseId=$_POST['courseId'];
    $topicId=$_POST['topicId'];
    $query="update studentassignment set AssignmentStatus=1 where courseId='$courseId' and topicId='$topicId' and rollno='$id'";
    $result=mysql_query($query) or die(mysql_error());
    $query="update uploadassignment set Reassign=0 where courseId='$courseId' and topicId='$topicId' and rollno='$id'";
    mysql_query($query) or die(mysql_error());
    header("location:studentInfo.php?Id=$id&a#ui-tabs-3");
    exit();
}
// start of change tutor code
?>

<?php
if(isset($_POST['changeTutor']))
{
    $chgetutor=$_POST['chgetutor'];
    if($chgetutor==0)
    {



        //sleep(5);
        header("location:studentInfo.php?Id=$id&ter#ui-tabs-3");
        exit();

    } else {

        $query="update assigncourse set tutorId='$chgetutor' where rollno='$id'";
        $result=mysql_query($query) or die(mysql_error());
        $query="update uploadassignment set tutorId='$chgetutor' where rollno='$id'";
        mysql_query($query) or die(mysql_error());
        header("location:studentInfo.php?Id=$id&tas#ui-tabs-3");
        exit();


    }
}
// end of change tutor
?>






<?php
$q="select * from assigncourse where rollno='$id'";

$r=mysql_query($q) or die(mysql_error());
if(mysql_num_rows($r) > 0)
{
    $result=mysql_fetch_array($r);

    $q="select concat_ws(' ',firstname,lastname) as full from tutor where tutorId=".$result['tutorId'];
    $r=mysql_query($q) or die(mysql_error());

    $re=mysql_fetch_array($r);
}

?>