TUJUAN :
1. Create folder dan menggunakan no kad pengenalan sebagai nama folder.
2. Data akan disimpan merujuk kepada nombor kad pengenalan yang telah terbina (Folder).
HTML
<tr>
<td colspan="5">Following document as supporting documentation of this application.</td>
</tr>
<tr>
<td colspan="3">Certified True Copy of Business Registration Certificate
<?php if ($row_data['DirBusinessRegCert'] == '' )
{ echo '1. Business Registration Certificate' ; }
else {
?>
<a href="../CLFiles/<?php echo $row_data['IC_No']."/"; ?><?php echo $row_data['DirBusinessRegCert']; ?>">1. Business Registration Certificate</a>
<?php }?></td>
<td> </td>
<td></td>
</tr>
<tr>
<td colspan="3">Certified True Copy of Certification by Employer
<?php if ($row_data['DirEmployerCert'] == '' )
{ echo '2. Employer Certificate'; }
else {
?>
<a href="../CLFiles/<?php echo $row_data['IC_No']."/"; ?><?php echo $row_data['DirEmployerCert']; ?>">2. Employer Certificate</a>
<?php }?></td>
<td> </td>
<td></td>
</tr>
---------------------------------------------------------------------------------------------
FUNCTION
public function new_form16($IC_No,$Year_Exp, $CD_Action, $DT_Applied, $DirBusinessRegCert, $DirEmployerCert)
{
$Dt_Created = date('Y-m-d H:i:s');
$log_id = $_SESSION['log_id'];
$DT_Applied = date('Y-m-d H:i:s');
$year_app= date('Y');
$result = mysql_query("SELECT RUNNING_NO FROM Cnt_AppNo WHERE `Year` = '$year_app' AND IC_No = '$IC_No' ORDER BY RUNNING_NO DESC");
$row_appno = mysql_fetch_array($result);
$totalrow_appno = mysql_num_rows($result);
if ($totalrow_appno==0 )
{
mysql_query("INSERT INTO Cnt_AppNo(RUNNING_NO, `Year`, IC_No) values ('1', '$year_app', '$IC_No')");
}
else{
mysql_query("UPDATE Cnt_AppNo SET RUNNING_NO = RUNNING_NO + 1 WHERE `Year` = '$year_app' AND IC_No = '$IC_No'");
}
$result = mysql_query("SELECT RUNNING_NO FROM Cnt_AppNo WHERE `Year` = '$year_app' AND IC_No = '$IC_No' ORDER BY RUNNING_NO DESC");
$row_app_no = mysql_fetch_array($result);
$count = sprintf('%02d',$row_app_no['RUNNING_NO']);
$string = $year_app;
$year1 = "$string[0]$string[1]";
$year = "$string[2]$string[3]";
$app_no = $IC_No.$year.$count;
$result = mysql_query("INSERT INTO TR_RegistrationCL (ApplicationNo,IC_No, Year_Exp, CD_Action, Status, Result, DT_Applied, ID_Created, DT_Created) values ('$app_no', '$IC_No', '$Year_Exp', '1', 'B16', '-', '$DT_Applied', '$log_id','$Dt_Created')") or die(mysql_error());
$name = $DirBusinessRegCert['name'];
$size = $DirBusinessRegCert['size'];
$name1 = $DirEmployerCert['name'];
$size1 = $DirEmployerCert['size'];
if (($DirBusinessRegCert['name'] != '') && ($DirEmployerCert['name'] != '')){
mkdir("../CLFiles/".$IC_No, 0777); // cara create folder nama ( folder name = CLFiles)
$path = "../CLFiles/".$IC_No."/";
$valid_formats = array("docx", "doc", "pdf"); // format yang dibenarkan untuk upload data
if(strlen($name||$name1))
{
list($txt, $ext) = explode(".", $name);
list($txt1, $ext1) = explode(".", $name1);
if((in_array($ext,$valid_formats) && $size<(500*500)) || (in_array($ext1,$valid_formats) && $size1<(500*500)))
{
$actual_image_name = $txt.".".$ext;
$tmp = $DirBusinessRegCert['tmp_name'];
$actual_image_name1 = $txt1.".".$ext1;
$tmp1 = $DirEmployerCert['tmp_name'];
move_uploaded_file($tmp, $path.$actual_image_name);
move_uploaded_file($tmp1, $path.$actual_image_name1);
$file_location = $path.$actual_image_name;
$file_location1 = $path.$actual_image_name1;
$result = mysql_query("UPDATE TR_RegistrationCL SET DirBusinessRegCert = '$actual_image_name', DirEmployerCert = '$actual_image_name1' WHERE ApplicationNo = '$app_no'");
}
}
}
return $result;
}
Posted by : Mariatulkibtiah
0 comments:
Post a Comment