1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php session_start(); include('../../../'.$_SESSION['web_name'].'/connect.php'); include('../../function_msg.php'); check_user_permission($_SESSION['admin_web']);
$arrayData = setArrayToAdd($_POST['formData']); $arrayFile = $_POST['fileData']; $gallery_add = isset($arrayData['id_topic']) ? $arrayData['id_topic'] : ''; $gallery_update = isset($arrayData['id_update']) ? $arrayData['id_update'] : '';
$result = ''; if(isset($arrayFile)){ $sqlmax = "select max(id_record + 1) nomax from port_gallery_record"; $resultmax = mysql_query($sqlmax); $datamax = mysql_fetch_assoc($resultmax); $nomax = $datamax['nomax'] == '' ? 1 : $datamax['nomax']; $id_topic = $gallery_add > 0 ? $gallery_add : $gallery_update; foreach($arrayFile as $k => $data){ $arr_value[$k] = "('$nomax', '$id_topic', '$data[file_name]', '$data[explain]', '', '1')"; ++$nomax; } if(isset($arr_value)){ $str_value = implode(',', $arr_value); $insert = "INSERT INTO port_gallery_record VALUES $str_value"; if(mysql_query($insert)){ $result = $gallery_add > 0 ? 'index.php?mod=gallery_update&path=gallery&id_update='.$gallery_add : #'index.php?mod=gallery_output&path=gallery&id_topic='.$gallery_add : 'index.php?mod=gallery_update&path=gallery&id_update='.$gallery_update.'&block='.$arrayData['block']; } } }
echo $result;
?>
|