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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
<?php include_once('../../check_login.php'); ini_set('display_errors',0); $type = $_GET["type"]; $id = $_GET["refid"]; $titlearray = array('1'=>'橫額','2'=>'位置1','3'=>'位置2','4'=>'位置3','5'=>'位置4','6'=>'位置5'); if($id){ $sth1 = $dbh->prepare("SELECT * FROM banner WHERE refid =? AND deleted = ?"); $parameter = array((int)$_GET["refid"], "0"); if (!$sth1->execute($parameter)) throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); $row = $sth1->fetch(PDO::FETCH_ASSOC); $type = $row['type']; if (!$sth1->execute($parameter)){ throw new Exception('[' . $sth1->errorCode() . ']: ' . print_r($sth1->errorInfo())); $row = $sth1->fetch(PDO::FETCH_ASSOC); $sql99 = "SELECT * FROM sys_cms_login WHERE cmsloginid=?"; $sth99 = $dbh->prepare($sql99); $sth99->execute(array((int)$row{'lastupby'})); $row99 = $sth99->fetch(PDO::FETCH_ASSOC); } } ?> <!DOCTYPE html> <html> <head> <?php require_once('../../head.php'); ?> <script type="text/javascript" src="../../js/validation.js"></script> <script> function save(){ var error = false; if($('#photo').val()){ var check = false; var str=$('#photo').val(); var checkArray = new Array('JPG','jpg','GIF','gif','PNG','png'); for(var i=0;i<checkArray.length;i++){ if(str.indexOf(checkArray[i]) > 0){ check = true; } } if(check == false){ $('#e4').show(); error = true; }else{ var total_upload_qualification_file_size = 0; if (!navigator.userAgent.match(/msie/i)) { if($("#photo")[0].files[0]){ total_upload_qualification_file_size += parseFloat($("#photo")[0].files[0].size/1024/1024); } if(total_upload_qualification_file_size > 2){ $('#e5').show(); error = true; } } } } if($("#LiForm").valid() && error == false){ $("#LiForm").submit(); } } </script> <?php #include_once("../uploader/upload_init.php"); ?> </head> <body> <form id="LiForm" action="banner_process.php" method="post" name="addform" enctype="multipart/form-data"> <input type="hidden" name="type" value="<?=$type?>"/> <? if($id){?> <input type="hidden" name="id" value="<?=$id?>"/> <? }?> <table width="800" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="70" align="right" valign="middle" class="icontxt"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="50" align="center" style="font-size: 12px;"><img alt="submit" src="../../images/iconSave.png" width="32" height="32" border="0" onClick="save()" style="cursor:pointer;"> <br> 儲存 </a></td> <td width="50" align="center"><a href="banner_index.php?type=<?=$type?>&msg=取消"><img src="../../images/iconCancel.png" alt="Cancel" width="32" height="32" border="0"><br> 取消 </a></td> <td> </td> </tr> </table></td> </tr> <tr> <td class="pagetitletxt"> <b><img src="../../images/iconList.jpg" width="48" height="48" align="absmiddle"/> <?=$titlearray[$type]?> > <?=$id?'編輯':'新增'?> </b> <? if($id){?> <span style="float:right;" class="msg">最後更新: <?= $row99{'cmsloginname'} . ' ' . $row{'lastupdate'}; ?> </span> <? }?></td> </tr> <tr> <td align="left" valign="middle"><!-- Content --> <div id="LiContentTable"> <table border="0" cellpadding="0" cellspacing="0"> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="120" align="left" valign="middle" class='content'>名稱 <br> [ <?= $langname; ?> ] </td> <td align="left" valign="middle" class='content'>: </td> <td class='content'><input name="name_<?= $langcode; ?>" type="text" class="inputer required" value="<?=$row['name_'.$langcode]?>" style="width:497px;"></td> </tr> <?php } ?> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="120" align="left" valign="middle" class='content'>簡介 <br> [ <?= $langname; ?> ] </td> <td align="left" valign="middle" class='content'>: </td> <td class='content'><textarea name="intro_<?= $langcode; ?>" class="inputer" style="width:497px; height:40px;"><?=$row['intro_'.$langcode]?></textarea></td> </tr> <?php } ?> <?php foreach ($arraylangcode as $langcode => $langname) { ?> <tr> <td width="120" align="left" valign="middle" class='content'>連結<br> [ <?= $langname; ?> ] </td> <td align="left" valign="middle" class='content'>: </td> <td class='content'><input name="link_<?=$langcode;?>" type="text" class="inputer" value="<?=$row['link_'.$langcode]?>" style="width:497px;"> <br> 例子:http://www.onesolution.com.hk/ </td> </tr> <? }?> <tr> <td width="100" align="left" valign="middle" class='content'>圖片</td> <td width="5" align="left" valign="middle" class='content'>: </td> <td class='content'> <? $width = "width='500'"; $height = "height='333'"; ?> <? if($id && $row{'photo'}){?> <div><img src='../../../file/banner/<?=$row{'photo'}?>' <?=$width?> <?=$height?> border='0'></div> <? }?> <input name="photo" type="file" id="photo" class="inputer <? if(!$id || !$row{'photo'}){?>required<? }?>" size="100"/> <div class="error2" id="e4">只能上載JPG,PNG,GIF的圖片檔案</div> <div class="error2" id="e5">上載的檔案不能大於2MB</div> <br/> <span class="msg">圖片格式: gif,jpg,png | 大小: 1900x1267px </span></td> </tr> </table> </div> <!-- End Content --></td> </tr> <tr> <td align="left" valign="middle"> </td> </tr> </table> </form> </body> </html>
|