50 lines
2.2 KiB
PHP
50 lines
2.2 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['suggest_type'] != '' && $array['title'] != '' && $array['content'] != '' && $array['photos'] != '' && count( $photos ) > 0 ){
|
|
$status = '203' ;
|
|
|
|
if ( $mysqli->query( "INSERT INTO formheadcount
|
|
( `branch_id`, `staff_id`, `type`, `title`, `content`, `status` ) VALUES
|
|
( '".$array['branch_id']."', '".$staff_info['staff_id']."', '".$array['suggest_type']."', '".$array['title']."', '".$array['content']."', 'pending' )" ) ){
|
|
$status = '200' ;
|
|
|
|
$boolean_submit = true ;
|
|
$formheadcount_id = $mysqli->insert_id ;
|
|
|
|
$formheadcount_so = 'SG'.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( 'Suggestion', $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' ) ;
|
|
?>
|