Toggle main menu visibility
新聞
下載
教材
影音
討論
其他選單
好站連結
行事曆
電子相簿
常見問題
萬用表單
即時留言簿
友站消息
社大學員
:::
登入
登入
帳號
密碼
登入
重整畫面
:::
所有書籍
「[982]PHP網站開發 進階應用技巧」目錄
MarkDown
10. 多檔上傳
1. 簡易jquery應用
1-1 index.html
2. jquery六大工具(上)
2-1 tabs範例
2-2 tabs AJAX範例
2-3 垂直選單
2-4 水平選單
3. jquery六大工具(下)
4. 即時新增表單欄位
4-1 telbook.php
4-2 電話簿+垂直捲軸
5. 表單驗證
5-1 mem.php
5-2 mem_chk.php
5-3 jquery.validationEngine-tw.js
6. PHP圖表pChart
6-1 demo1.php
7. 月曆功能
7-1 get_event.php(正確完成版,可抓出該月事件)
8. CSV的匯出與匯入
9. 所見即所得編輯器
10. 多檔上傳
10-1 index.php
11. 縮圖及上傳物件
11-1 index.php
12. 製作PDF檔(上)
12-1 pdf.php
12-2 解決Linux下PDF無法秀出中文
13. 製作PDF檔(下)
13-1 pdf.php
14. 線上影像合成
14-1 index.php
14-2 pic.php
15. 圖形認證與計數器
15-1 index.php
15-2 pic.php
15-3 show.php
15-4 counter.php
16. Google Map初探
16-1 index.html
17. 搜尋存取GMap位置
17-1 index.php
18. 憑空生出Excel檔
18-1 12月份工作表
18-2 excel.php
11. 縮圖及上傳物件
\[982\]PHP網站開發 進階應用技巧 ===================== <?php $root\_pass="12345"; //資料庫root密碼 $db\_name="test"; //資料庫名稱 /\* 連資料庫檢查 \*/ $link=mysql\_connect("localhost","root",$root\_pass); //資料庫連線 mysql\_select\_db("test"); mysql\_query("SET NAMES 'utf8'"); //設定語系 if($\_POST\['op'\]=="save"){ save\_event(); } //儲存事件 function save\_event(){ $sql="insert into diary (`date`,`event`) values ('{$\_POST\['date'\]}','{$\_POST\['event'\]}')"; mysql\_query($sql) or die($sql); $sn=mysql\_insert\_id(); if(!empty($\_FILES\['pic'\]\['tmp\_name'\])){ foreach($\_FILES\['pic'\]\['tmp\_name'\] as $i => $tmpname){ move\_uploaded\_file($tmpname , "userfiles/images/{$sn}\_{$\_FILES\['pic'\]\['name'\]\[$i\]}"); } } header("location:index.php"); } //讀取事件的下拉選單 function select\_event($select\_sn=""){ $sql="select \* from diary order by date desc , sn"; $result=mysql\_query($sql) or die($sql); $main="<select onChange=\\"location.href='index.php?sn='+this.value\\"> <option value=''>撰寫日記</option>"; while(list($sn,$date,$event)=mysql\_fetch\_row($result)){ $selected=($select\_sn==$sn)?"selected":""; $main.="<option value='$sn' $selected>$date</option>"; } $main.="</select>"; return $main; } //讀取某個事件 function show\_event($sn=""){ if(empty($sn))return;
$pic=get\_pic($sn);
$sql="select \* from diary where sn='$sn'"; $result=mysql\_query($sql) or die($sql); list($sn,$date,$event)=mysql\_fetch\_row($result); $main="<div class='page'>{$event}
{$pic}
</div>"; return $main; }
//抓出圖檔 function get\_pic($sn=""){ $dir = "userfiles/images/"; if (is\_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $ff=explode("\_",$file); if($ff\[0\]==$sn){ $pics.="<img src='{$dir}{$file}'>"; } } closedir($dh); } } return $pics; }
?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel='stylesheet' type='text/css' media='screen' href='style.css' /> <title>我的記事本</title> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="js/jquery\_ui\_datepicker/jquery\_ui\_datepicker.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#date').datepicker({ userLang : 'zh-TW', americanMode: false, dateFormat: 'yy-mm-dd' }); }); </script> <script src="js/jquery\_ui\_datepicker/i18n/ui.datepicker-zh-TW.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="js/jquery\_ui\_datepicker/smothness/jquery\_ui\_datepicker.css"> <script src="js/jquery.MultiFile.js" type="text/javascript"></script> </head> <body> <?php echo show\_event($\_GET\['sn'\]);?> <form action="index.php" method="post" enctype="multipart/form-data"> 日期:<input name="date" type="text" id="date" size="20"> <?php echo select\_event($\_GET\['sn'\]);?> <br />附檔:<input type="file" name="pic\[\]" class="multi" accept="jpg|png|gif|jpeg" maxlength="3"/> <input type="submit" value="儲存" id="submit"><br> <textarea name='event' cols=80 rows=15 class="ckeditor"></textarea> <input name="op" type="hidden" value="save"> </form> </body> </html>
:::
搜尋
search
進階搜尋
QR Code 區塊
快速登入
所有討論區
「PHP全端開發」線上課程討論區
XOOPS使用討論區
一般研習學員
社大學員專用
路過哈啦區
XOOPS佈景設計
XOOPS模組開發
Tad書籍區
即時留言簿
書籍目錄
展開
|
闔起
線上使用者
90
人線上 (
22
人在瀏覽
線上書籍
)
會員: 0
訪客: 90
更多…