LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

50 lines
2.1 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
$formheadcount_id = $array['formheadcount_id'] ;
$photos = $array['photos'] ;
if ( $array['title'] != '' && $array['content'] != '' && $array['photos'] != '' && count( $photos ) > 0 ){
$status = '203' ;
if ( $mysqli->query( "INSERT INTO formheadcount
( `branch_id`, `staff_id`, `title`, `content`, `remark`, `status` ) VALUES
( '".$array['branch_id']."', '".$staff_info['staff_id']."', '".$array['title']."', '".$array['content']."', '".$array['remark']."', 'pending' )" ) ){
$status = '200' ;
$boolean_submit = true ;
$formheadcount_id = $mysqli->insert_id ;
$formheadcount_so = 'FH'.strPad( 6, $formheadcount_id ) ;
$mysqli->query( "UPDATE formheadcount SET
formheadcount_so = '".$formheadcount_so."'
WHERE formheadcount_id = '".$formheadcount_id."'" ) ;
if ( checkExists($photos) ){
foreach ( $photos as $k => $v ){
if ( $v['type'] == 'local' ){
$file_upload = ( $v['file'] ) ;
$upload = uploadImage( 'FormHeadCount', $formheadcount_id.'-'.$formheadcount_id, $file_upload ) ;
if ( $upload['status'] != '200' ){
$count_upload++ ;
}else{
$mysqli->query( "INSERT INTO formheadcount_media
( formheadcount_id, file, filetype ) VALUES
( '".$formheadcount_id."', '".$upload['data']['file_name']."', '".$upload['data']['file_type']."' )" ) ;
$status = '200' ;
}
}
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>