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' ;
$suggestion_id = $array['suggestion_id'] ;
$photos = $array['photos'] ;
if ( $array['suggest_type'] != '' && $array['title'] != '' && $array['content'] != '' && $array['photos'] != '' && count( $photos ) > 0 ){
$status = '203' ;
if ( $mysqli->query( "INSERT INTO suggestion
( `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 ;
$suggestion_id = $mysqli->insert_id ;
$suggestion_so = 'SG'.strPad( 6, $suggestion_id ) ;
$mysqli->query( "UPDATE suggestion SET
suggestion_so = '".$suggestion_so."'
WHERE suggestion_id = '".$suggestion_id."'" ) ;
if ( checkExists($photos) ){
foreach ( $photos as $k => $v ){
if ( $v['type'] == 'local' ){
$file_upload = ( $v['file'] ) ;
$upload = uploadImage( 'Suggestion', $suggestion_id.'-'.$suggestion_id, $file_upload ) ;
if ( $upload['status'] != '200' ){
$count_upload++ ;
}else{
$mysqli->query( "INSERT INTO suggestion_media
( suggestion_id, file, filetype ) VALUES
( '".$suggestion_id."', '".$upload['data']['file_name']."', '".$upload['data']['file_type']."' )" ) ;
$status = '200' ;
}
}
}
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>