2013年10月15日 星期二

網站簡介



1.fever38 發燒網 http://www.fever38.com/
簡介:Fever38 發燒網是一個社群行銷活動的平台,提供社群網站上各種整合行銷工具,
協助商家輕鬆舉辦各種網路活動,如留言抽獎、徵件票選、有獎徵答等等的方式招募粉絲推廣
商家知名度,並在每次的活動過程中建立品牌形象,經營粉絲關係博取粉絲對品牌的好感及認
同,最終達到粉絲成為顧客,粉絲與商家各得所需的雙贏模式。

2013年5月31日 星期五

非法字符

function safe_string($str){ //過濾安全字符
$str=str_replace("'","",$str);
$str=str_replace('"',"",$str);
$str=str_replace(" ","$nbsp;",$str);
$str=str_replace("\n;","
",$str);

$str=str_replace("<","<",$str);
$str=str_replace(">",">",$str);
$str=str_replace("\t"," ",$str);
$str=str_replace("\r","",$str);
$str=str_replace("/[\s\v]+/"," ",$str);
return $str;
}

2013年5月29日 星期三

網站 壓力測試

ab - Apache HTTP server benchmarking tool
http://httpd.apache.org/docs/2.2/programs/ab.html
ab 工具程式是 Apache 網站伺服器軟體的一個附帶的工具軟體,專門用來執行網站伺服器的運行效能

說明:http://blog.miniasp.com/post/2008/06/30/Using-ApacheBench-ab-to-to-Web-stress-test.aspx

2013年5月14日 星期二

jQuery.ptTimeSelectA jQuery Plugin

網址:http://pttimeselect.sourceforge.net/example/index.html
功能:用來選擇時間的功能。
簡述:使用UI來做。

2013年4月30日 星期二

針對IE 改寫 table

使用時機:table 沒有特定下使用

//針對div .mintabletwo底下數個table 且沒有class。
$(function(){
 var version = $.browser.msie;
  
 if(version){ //因為ie會把表格線弄的很淡,所以在這邊動點手腳。如果會影響到表格的影響,請更改之。
  $('.mintabletwo table').each(function(index){
   var wid_var=$(this).attr('border');
   if (typeof wid_var === "undefined"|| wid_var=='0'){
    $('.mintabletwo table:eq('+index+')').addClass('noLine');
   }else{
    $('.mintabletwo table:eq('+index+')').addClass('haveLine');
   }
  })
  $('.haveLine').css('border', '1px solid black');
 }
})


補充說明:
.eq() 教學連結
.find() 教學連結
.addClass() 教學連結

2013年4月29日 星期一

水平menu

網址:http://css.maxdesign.com.au/listutorial/horizontal_master.htm

CSS CODE
#navcontainer ul
{
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}

#navcontainer ul li { display: inline; }

#navcontainer ul li a
{
text-decoration: none;
padding: .2em 1em;
color: #fff;
background-color: #036;
}

#navcontainer ul li a:hover
{
color: #fff;
background-color: #369;
}


HTML CODE
<div id="navcontainer">
<ul>
<li><a href="#">Milk</a></li>
<li><a href="#">Eggs</a></li>
<li><a href="#">Cheese</a></li>
<li><a href="#">Vegetables</a></li>
<li><a href="#">Fruit</a></li>
</ul>
</div>


微軟作業系統 關機指令 shutdown

一直忘記,所以寫這篇,方便自己檢索。

方法1:


  • 立即關機:shutdown -s -t 0
  • 登出:shutdown -l
  • 立即重新啟動:shutdown -r -t 0
  • 30秒後關機:shutdown -s -t 30
  • 1小時後關機:shutdown -s -t 3600
  • 3小時後關機:shutdown -s -t 10800
  • 取消關機 SHUTDOWN -a


方法2:

開始→執行→輸入『taskmgr』→WINDOWS工作管理員→工具列有一個選項『關機』

2013年4月23日 星期二

排序更改

示意片:

$sort =$_POST['sort'];
$sortBL =$_POST['sortBL'];
$year =$_POST['year'];
$cat =$_POST['cat'];
$id =$_POST['sn'];
//B 代表 前面
//L 代表 後面
 if($sort=='abcd')
  echo_script_alert_ref("無效選擇,請勿選擇自己","XXXXX");
      
 if($sortBL=='B'){//改到xxx之前
  $sql="UPDATE col_doc_xxx SET sort=sort+1 WHERE sort >= '$sort' AND year_sn='$year' AND cat_sn='$cat'";      
  mysql_query($sql);
  //塞此id 的sort 為$sort
  $sql="UPDATE col_doc_xxx SET sort=$sort WHERE file_sn='$id'";
  mysql_query($sql);
 }
 if($sortBL=='L'){// 改到XXX之後
  $sql="UPDATE col_doc_xxx SET sort=sort-1 WHERE sort <= '$sort' AND year_sn='$year' AND cat_sn='$cat'";      
  mysql_query($sql);
  //塞此id 的sort 為$sort
  $sql="UPDATE col_doc_xxx SET sort=$sort WHERE file_sn='$id'";
  mysql_query($sql);
 }
 echo_script_alert_ref("更新完成","xxx");

過濾$_GET和$_POST

Q:從使用者輸入篩除危險的字元
<?php
/*
判斷傳遞的變量中是否含有非法字符 
//要過濾的非法字符 如post get
*/

$ArrFiltrate=array("’",";","union","true","../"); 
//出錯後要跳轉的url,不填則默認前一頁 
$StrGoUrl="http://XXX.tw"; 
 //是否存在數組中的值 
function FunStringExist($StrFiltrate,$ArrFiltrate){
 foreach ($ArrFiltrate as $key=>$value){
  if(eregi($value,$StrFiltrate)){
   return true;
  }
 }
 return false;
}
foreach($_POST as $key=>$value){
 $ArrayPostAndGet[]=$value;
}
foreach($_GET  as $key=>$value){
 $ArrPostAndGet[]=$value;
}
//驗證開始
foreach($ArrPostAndGet as $key=>$value){

 if(FunStringExist($value,$ArrFiltrate)){
  
  if(empty($StrGoUrl)){
   echo "<script>history.go(-1);</script>";
  }else{   
   echo_script_alert_ref("非法字符",'');
  }
 }
}
?>



範例:以下連結會被過濾 將不能執行

正確網址加 /index.php?module=Opportunities&action=/../../../../../../../../boot.ini%
00&advanced=true HTTP/1.0

2013年4月12日 星期五

Twitter Bootstrap 網頁美化工具


Sleek, intuitive, and powerful front-end framework for faster and easier web development.


     

Q:怎麼對select 或input 標籤做寬度(width)設定?

.input-small-mini 30px,
.input-mini .... 60px, 
.input-small  .... 90px,
.input-besmall.....110px(個人新增)
.input-medium  .... 150px,
.input-large  ....210px,
.input-xlarge  .... 270px,
.input-xxlarge  .... 530px,


Q:怎麼對button或input 加入顏色?


class加入btn ,這是基本的
加入顏色可以指定"btn btn-primary" 可以有藍色且立體的視覺感。

如果要加入其他顏色的,必需在bootstrap.css加入客製的CSS,可以利用下面網頁方便完成。
http://charliepark.org/bootstrap_buttons/

Q:BUTTON怎麼加入小圖案icon

參考:http://www.plugolabs.com/twitter-bootstrap-button-generator/
http://twitter.github.io/bootstrap/base-css.html#icons
語法: class="icon-white icon-heart"


Q:在瀏覽器IE 可以使用嗎?

  無法在 IE 7 8 9 (俗稱的舊版 IE)完整顯示。因為舊版IE末完整支援HTML5

2013年4月11日 星期四

input加入灰色提示文字

<input type='text' name='e_title' size='40' style="color:#999999" value='請填入含年度的考古題標題' onfocus="if (this.value=='請填入含年度的考古題標題') this.value='';this.style.color='#000';" onblur="if (this.value==''){this.value='請填入含年度的考古題標題';this.style.color='#999';}">(範例:<b>一零一學年度碩士班招生考試試題 </b>)<br>

pci簡單通訊控制器 是什麼?

在灌筆電時,這個東西一直找不到適當的驅動來使用。

只好有請狗歌大大了。

這篇有提到:
http://www.mobile01.com/topicdetail.php?f=514&t=1865568

原來是要灌intel的東西
https://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=18532&ProdId=3150&lang=eng

2013年4月9日 星期二

ini_set error 、DIRECTORY_SEPARATOR

設定php發生錯誤的等級
ini_set('error_reporting', E_ALL);

ConstantDescriptionNote
E_NOTICERun-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
E_STRICTEnable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.Since PHP 5 but not included in E_ALL until PHP 5.4.0
E_ALLAll errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0.


ini_set('error_reporting', E_ALL);
ini_set('track_errors', '1');
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');

DIRECTORY_SEPARATOR

DIRECTORY_SEPARATOR是php的內部常量,用於顯示系統分隔符的命令,不需要任何定義與包含即可直接使用。在windows下路徑分隔符是\(當然/在部分系統上也是可以正常運行的),在linux上路徑的分隔符是/,這就導致了一個問題,比如伺服器是windows,有一個圖片上傳程序,伺服器上指定的上傳文件保存目錄是define('ROOT', dirname(__FILE__)."/upload");

於是php引入了DIRECTORY_SEPARATOR變量,可以將上面的寫法改寫为:
define('ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR."upload");

引申閱讀:


  1.     上傳圖片
  2.    上傳檔案簡易版

2013年4月2日 星期二

HTML5 取代部份javascript

javascript 一載入就停駐在頁數(focus)

Javascript+HTML:
書名:<input type="text" name="a" id="a"/><br/>
頁數:<input type="text" name="b" id="b"/>
<script type="text/javascript">
 document.getElementById("b").focus();
</script>
HTML5:(並非所有的瀏覽器都支援)可支援:IE9、chrome
在頁數的input加入autofocus
書名:<input type=text name=a /><br/>
頁數:<input type=text autofocus name=b />

sort 數字和非數字

資料需要鍵入一個值當成資料的排序,使用非數字依然是沒什麼問題。
可是當要用來更改排序時,比大小就會出現狀況,可能會有多個值是會被符合的。

比如說,我要把比5大的sort都加1,那比5大的會有哪些呢? 這就是一個問題。

2013年3月26日 星期二

ckeditor 4.1 範例

<!DOCTYPE html>
<html>
<head>
<title> 路上線上預約系統-編輯借用路邊及垃圾使用規則</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" href="ckeditor/contents.css">
</head>


<form action='comm.php?method=up_rule' method='post'>
<textarea class="ckeditor" cols="60" id="editor1" name="editor1" rows="10">
<?php echo $data['rule']; ?>
</textarea>
<input type='hidden' name='op' value='edit'>
<input type='submit' value='更新規則'>
</form>
<input type="button" onclick="doClose()" value="關閉此頁面"/>




</body>
</html>



補充:HTML5 起始1

用到上傳圖片功能的 config.js

CKEDITOR.editorConfig = function( config ) {
 // Define changes to default configuration here. For example:
 // config.language = 'fr';
  config.uiColor = '#AADC6E';
  
 config.toolbar = [
    ['Bold','Italic','Underline','Strike','-'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],

    ['TextColor','BGColor','Maximize','ShowBlock'], ['Link','Unlink','Anchor','Table','HorizontalRule'],'/',['Styles','Format','Font','FontSize','Source','Image']
    ];
 config.filebrowserImageUploadUrl = '../../script/ckeditor4.1/upload1.php?type=img';

};
upload1.php(上傳圖片用的程式)
<?php

$config=array();

$config['type']=array("flash","img"); //上傳允許type值

$config['img']=array("jpg","bmp","gif","png"); //img允許后綴
$config['flash']=array("flv","swf"); //flash允許后綴

$config['flash_size']=200; //上傳flash大小上限 單位:KB
$config['img_size']=2000; //上傳img大小上限 單位:KB 

//$config['message']="上傳成功"; //上傳成功后顯示的消息,若為空則不顯示

$config['name']=mktime(); //上傳后的文件命名規則 這里以unix時間戳來命名




$config['img_dir']="uploadtpd/img"; //上傳img文件地址
$config['site_url']="http://XXXXX/coledXX/tpd/"; //網站的網址 這與圖片上傳后的地址有關 最后不加"/" 可留空
//在上傳圖片後會在URL會用到,並寫到資料庫裡去。
//文件上傳
uploadfile();

function uploadfile()
{
global $config;
//判斷是否是非法調用
if(empty($_GET['CKEditorFuncNum']))
   mkhtml(1,"","錯誤的功能調用請求4");
$fn=$_GET['CKEditorFuncNum'];
if(!in_array($_GET['type'],$config['type']))
   mkhtml(1,"","錯誤的文件調用請求3");
$type=$_GET['type'];
if(is_uploaded_file($_FILES['upload']['tmp_name']))
{
   //判斷上傳文件是否允許
   $filearr=pathinfo($_FILES['upload']['name']);
   $filetype=$filearr["extension"];
   if(!in_array($filetype,$config[$type]))
    mkhtml($fn,"","錯誤的文件類型!2");
   //判斷文件大小是否符合要求
   if($_FILES['upload']['size']>$config[$type."_size"]*1024)
    mkhtml($fn,"","上傳的文件不能超過".$config[$type."_size"]."KB!");
   //$filearr=explode(".",$_FILES['upload']['name']);
   //$filetype=$filearr[count($filearr)-1];
   //$file_abso=$config[$type."_dir"]."/".$config['name'].".".$filetype;
    $file_abso=$config[$type."_dir"]."/".$config['name'].".".$filetype;  //資料夾和檔案路徑
 //echo $file_abso;
 //exit;
  // $file_host=$_SERVER['DOCUMENT_ROOT'].$file_abso;  //絕對路徑
   $file_host="../../../".$config[$type."_dir"]."/".$config['name'].".".$filetype;  //相對路徑
   // echo $file_host;
 //exit;
  
 
   if(move_uploaded_file($_FILES['upload']['tmp_name'],$file_host))
   {
    mkhtml($fn,$config['site_url'].$file_abso,$config['message']);
   }
   else
   {
    mkhtml($fn,"","文件上傳失敗,請檢查上傳目錄設置和目錄讀寫權限");
   }
}
}
//輸出js調用
function mkhtml($fn,$fileurl,$message)
{
$str='<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction('.$fn.', \''.$fileurl.'\', \''.$message.'\');</script>';
exit($str);
}
?>

補充說明:陣列,檔案操作
QA
抓BUG抓不出來,面版一直是最簡單的。
最後把tpd/tpdadmin/script/4.1丟上 社x院即成。

RSS建置

參考:
http://fxc86.blog.hexun.com.tw/26158783_d.html
FeedCreator.class.php

如果你的文章中有中文,生成的 RSS Feed 都會是亂碼,並且時間也和實際不相符或者顯示為一個 1970-01-01 值,
這是由於未設置正確編碼方式時區所造成的。

搜索源碼中的所有 var $encoding = “ISO-8859-1″,將編碼格式改為 utf-8;
搜索 define(”TIME_ZONE”,”+01:00″) 改為 空值其它時區格式,並且在給
RSS 條目賦時間時用 strtotime() 函數將日期字符串轉換為時間格式,這樣就不會造成顯示 1970 年的問題。
目前是使用+8000

原網站:http://www.bitfolge.de/index.php?option=com_content&view=article&id=67:feedcreator&catid=38:eigene&Itemid=59

收費RSS http://feedity.com/

目前RSS規範的主要版本有0.91、1.0和2.0等。
0.91版和1.0版完全不同,風格不同,制定標準的人也不同。0.91版和2.0版一脈相承。
1.0版更接近XML標準。目前世界上大多數知名,雖有很多種不同的RSS,但都定型於兩個重要的支幹(RDF和2.*)。

RDF或RSS 1.*的分支包括下列版本:
RSS 0.90原本屬於美國網景公司的版本。這個RSS被稱為RDF Site Summary,但其基礎構圖建立在初期的RDF規格上,以及和末版的RDF推薦標準不相容。
RSS 1.0是一個開放式的版本,由RSS-DEV工作團隊再次建立為RDF Site Summary。
RSS 1.0是一個像RSS 0.90的RDF形式,但是並沒有完全的和他相容,自從1.0基新聞網站都提供RSS訂閱支援。

變更了 rss.class的程式碼
http://www.phpernote.com/php-function/632.html


驗證 RSS的網站
http://validator.w3.org/feed/

更改class
原先:
$feed.= " <lastbuilddate>".htmlspecialchars($now->rfc822())."</lastBuildDate>\n";
更改為:
$feed.= " <pubdate>".htmlspecialchars($now->rfc822())."</pubDate>\n";

同場加映:
網頁設計.愛上jQuery(附光碟)
TQC+網頁程式設計認證指南HTML5 (附光碟)
別再說你不懂HTML5:圖解網頁設計必學的9堂課

2013年3月25日 星期一

jquery 應用





html

<form >
<table >
<caption><b>處理功能</b></caption>
<tr><th width='100px'>是否接受預約?</th>   <td><input type='radio' name='f_ok' id='f_ok' value='ok'>准許

<input type='radio' name='f_ok' id='f_no' value='no'>不准許
<div id='f_noarea' style='margin-left:20px'>
<input type='checkbox' name='a1' id='a1' class='checkNo' value='同時段XXX。'>同時段如有二位以上預約者時,XXXxxxXXX。

<input type='checkbox' name='a2' id='a2' class='checkNo' value='預約人XXXxxXXX。'>預約人XXXxxXXX。

<input type='checkbox' name='a3' id='a3' class='checkNo' value='不外借XXXxxXXX'>不外借XXXxxXXX。

<input type='checkbox' name='a4' id='a4' class='checkNo'>其他<input type='text' size='30' name='a4_note'>。

</div>
<input type='submit' value='送出' id='s01'></td></tr>
</table>
</form>

2013年3月24日 星期日

Epson AcuLaser CX16 安裝驅動


驅動連結:https://www.epson.com.tw/CustomerAndDownload/SearchResult/19236fe8-571b-4ca8-b1de-6a07ad7cb1bb
檔案名稱:驅動程式-中文版


TCP/IP 注意事項:安裝時,需注意您的作業系統是32位元的還是64位元的。等到驅動裝好後,會跳出 已完成安裝,屆時請到CX16按右鍵->印表機內容->連接埠底下新增連結埠->選擇HP Standard TCP/IP Port 鍵入 IP 即可完成網路印表機