thaiall logomy background
โค้ดดิ้ง รหัสต้นฉบับ
my town
Source : Perl | PHP | ASP | JSP | HTML | HTML5 | JavaScript | Java | COBOL | C++ | MS Access | VBNet | VB | Python | โค้ดดี
รหัสต้นฉบับ (Source code)
หัสต้นฉบับ (Source code) ที่แบ่งปันในหน้านี้ ไม่ใช่โปรแกรมที่สมบูรณ์ แต่เป็นเพียงตัวอย่างส่งเสริมการเรียนรู้ ถ้าคาดหวังโปรแกรมใช้งานได้ ลองค้นใน github.com หรือ sourceforge.net ที่มี freeware, shareware, repository และ open source มากมาย
    สารบัญ
  1. System 1 : Source Code ที่มีในหนังสือ "Openning source - perl php asp"
  2. System 2 : ระบบ YONOK Webboard [Perl]
  3. System 3 : ระบบสอบ online ในโรงเรียน แบบ no paper [ASP]
  4. System 4 : ระบบฐานข้อมูลของเว็บ lampang.go.th (internet, intranet) [ASP]
  5. System 5 : ระบบฐานข้อมูล e-Learning [ASP]
  6. System 6 : ระบบฐานข้อมูล IT Dictionary [PHP]
  7. System 7 : ระบบ Image Upload และ Download ใน MySQL [PHP]
  8. Subsystem CGI : รวม source code ที่ผมใช้อยู่ในห้อง cgi ที่ thaiall.com หรือที่น่าสนใจ
การเขียนโค้ดที่ดี มีหลัก 6 ข้อ
1. อ่านง่าย แก้ง่าย
- ไม่ต้องใช้เทคนิคซับซ้อนมากนัก เน้นที่ debug ง่าย
2. ตั้งชื่อตามหลักการ
- เช่น empl_id หรือ cust_name หรือ Customers
3. มีหมายเหตุช่วยให้อ่านง่าย
- อธิบาย module, function หรือ variable ตามความจำเป็น
4. เขียนแล้วเขียนอีก
- ครั้งแรกให้ทำงานได้ ครั้งต่อไปทำได้ดีกว่า
5. เรียนรู้จากคนอื่น
- stackoverflow, github, opensource, library, api
6. ใช้ภาษาเพื่อสื่อสาร
- อยู่บนหลักการสื่อสารที่มนุษย์สื่อสารกัน
How to write a good code โดย Arnon Puitrakul
บัญญัติ 6 ประการ ของการเขียน Code ที่ดี เพื่อให้ใช้งานได้ยาวนาน
Clean Code
การเขียนโปรแกรมเบื้องต้น
good_code.php
thaiall_functions.php
System 1 Source Code ที่มีในหนังสือ "Openning source - perl php asp"
0101 : intro / if.pl
0102 : intro / loop.pl
0103 : intro / sub.pl
0201 : shellcontrol / useshell.pl
0202 : shellcontrol / whereis.pl
0203 : shellcontrol / finger.pl
0204 : shellcontrol / gethost.htm
0205 : shellcontrol / gethostbyaddr.pl
0206 : shellcontrol / gethostbyname.pl
0207 : shellcontrol / listfilein.pl
0208 : shellcontrol / english.pl
0209 : shellcontrol / showenv.pl
0302 : basicupdate / index.html
0303 : basicupdate / recfirst.pl
0304 : basicupdate / recadd.pl
0305 : basicupdate / reclst.pl
0306 : basicupdate / recdel.pl
0307 : basicupdate / recchange.pl
0308 : basicupdate / filedel.pl
0402 : keywordupdate / index.html
0403 : keywordupdate / recfirst.pl
0404 : keywordupdate / recadd.pl
0405 : keywordupdate / reclst.pl
0406 : keywordupdate / recdel.pl
0407 : keywordupdate / recchange.pl
0408 : keywordupdate / recsort.pl
0502 : quiz / quizjava.pl
0503 : quiz / quizauto.pl
0504 : quiz / parse.pl
0601 : gallery / gallery.pl
0602 : gallery / pic.htm
0603 : gallery / pic.pl
0705 : regist / index.html
0706 : regist / evalsubj.pl
0707 : regist / evalopt.pl
0708 : regist / evalsave.pl
0709 : regist / grade.pl
0710 : regist / listunlink.pl
0711 : regist / registnew.htm
0712 : regist / registnew.pl
0713 : regist / parse.pl
0803 : board / index.html
0804 : board / boardadd.pl
0805 : board / boardlist.pl
0806 : board / boardsearch.pl
0807 : board / boardread.pl
0808 : board / boardreply.pl
0809 : board / boarddel.pl
0810 : board / parse.pl
0903 : counter / counter.htm
0904 : counter / counter.pl
0905 : counter / counterg.pl
0906 : counter / tracker.pl
0907 : counter / trackershow.pl
1001 : cart / cartprocess.htm
1002 : cart / cartprocess.pl
1101 : beginat / cooksave.pl
1102 : beginat / cookcall.pl
1103 : beginat / index.html
1104 : beginat / menu.pl
1105 : beginat / setdefault.pl
1106 : beginat / begin.pl
1201 : graphic / xbitmap.pl
1202 : graphic / 18.pl
1203 : graphic / 9to0.pl
1204 : graphic / circleline.pl
1301 : intro / index.php
1302 : intro / intro01.php
1303 : intro / intro02.php
1304 : intro / intro03.php
1305 : intro / intro04.php
1306 : intro / intro05.php
1307 : intro / intro06.php
1402 : textupdate / index.php
1403 : textupdate / create5.php
1404 : textupdate / listfile.php
1405 : textupdate / addnew.php
1406 : textupdate / deldata.php
1407 : textupdate / editdata.php
1408 : textupdate / delfile.php
1501 : mysqlupdate / index.php
1502 : mysqlupdate / step1connect.php
1503 : mysqlupdate / step2crtdb.php
1504 : mysqlupdate / step3select.php
1505 : mysqlupdate / step4insert.php
1506 : mysqlupdate / step5delete.php
1507 : mysqlupdate / step6update.php
1508 : mysqlupdate / step7drop.php
1601 : phpgallery / gal.php
1602 : phpgallery / galf.php
1701 : entrance / index.php
1702 : entrance / connect.php
1703 : entrance / entstdrestore.php
1704 : entrance / enttyperestore.php
1705 : entrance / entchkidstd.php
1706 : entrance / entchkidtype.php
1707 : entrance / entjoin.php
1708 : entrance / entputmany.php
1709 : entrance / crtqrydrp.php
1801 : cartbasic / cartbasic.php
1802 : cartbasic / cartbasicsave.php
1901 : vdo / connect.php
1902 : vdo / checkeid.php
1903 : vdo / createvdo.php
1904 : vdo / displayvdo.php
1905 : vdo / reportvdo.php
1906 : vdo / borrowvdo.php
2001 : sticker / index.php
2002 : sticker / putpic.php
2003 : sticker / puttxt.php
2101 : intro / default.asp
2102 : intro / function.asp
2103 : intro / p01.asp
2104 : intro / p02.asp
2105 : intro / p03.asp
2106 : intro / p04.asp
2107 : intro / randomeasy.asp
2108 : intro / randomarray.asp
2109 : intro / numtochar.asp
2201 : sort / default.asp
2202 : sort / bubble.asp
2203 : sort / newbubble.asp
2204 : sort / insertion.asp
2205 : sort / selection.asp
2206 : sort / shell.asp
2301 : keepvar / default.asp
2302 : keepvar / addapplication.asp
2303 : keepvar / addsession.asp
2304 : keepvar / removeappl.asp
2305 : keepvar / addsubj.asp
2401 : textsearch / search.dat
2402 : textsearch / default.asp
2403 : textsearch / crtsearch.asp
2404 : textsearch / listsearch.asp
2405 : textsearch / find.asp
2406 : textsearch / delrec.asp
2407 : textsearch / restore.asp
2502 : updatemdb / default.asp
2503 : updatemdb / crttab.asp
2504 : updatemdb / selecttab.asp
2505 : updatemdb / inserttmpch.asp
2506 : updatemdb / insert6.asp
2507 : updatemdb / searchtmpch.asp
2508 : updatemdb / edittmpnum.asp
2509 : updatemdb / controlrec.asp
2510 : updatemdb / deltmpch.asp
2511 : updatemdb / droptab.asp
2602 : quiz / default.htm
2603 : quiz / displayq.asp
2604 : quiz / displayqz.asp
2605 : quiz / quizauto.asp
2606 : quiz / quizjv.asp
2701 : emailconfirm / default.asp
2702 : emailconfirm / checkpass.asp
2703 : emailconfirm / sendmail.asp
2801 : creditcard / default.asp
2802 : creditcard / ccard.inc
2902 : casereg / default.htm
2903 : casereg / listpage.asp
2904 : casereg / groupadv.asp
2905 : casereg / regist.asp
System 2 Source Code ที่ใช้งานใน YONOK board
boardadd.pl
boardaddconfirm.pl
boarddel.pl
boardlist.pl
boardread.pl
boardreply.pl
boardreplyconfirm.pl
boardsearch.pl
boardview.pl
del.htm
footer.htm
header.htm
headers.htm
index.html
parse.pl
bsource.pl
บอร์ดนี้ใช้ source code ที่ปรับปรุงมาจากในหนังสือ perlphpasp.com
System 3 แนวคิด คำอธิบาย รายละเอียด และ case study
Source Code ที่ใช้จัดทำระบบสอบ online ในโรงเรียน แบบ no paper
default.asp
select.asp
delete.asp
quizseq.asp
quizran.asp
quizrannum.asp
quizran2.asp
โปรแกรมชุดนี้อ้างอิง source code ที่ปรับปรุงมาจากในหนังสือ perlphpasp.com
System 4 โปรแกรมเขียนด้วย ASP สำหรับเว็บลำปาง [ download (mdb+asp+img)]
Source Code ที่ใช้จัดทำระบบฐานข้อมูลของเว็บ lampang.go.th (internet, intranet)
select3.asp เปิดตารางจาก .mdb และ .xls (ปรับปรุงจาก select2.asp)
select2.asp เปิดตารางจาก .mdb โดยส่งชื่อ db tb field
select.asp เปิดตารางตาม key ที่ตั้งไว้ใน .asp
addnews.asp
connectboard.asp
connectinfo.asp
connectnews.asp
default.asp
displaynews.asp
faq.asp
footer.asp
header.asp
newsletter.asp
tb.asp
update.asp
System 5 Source Code ที่ใช้จัดทำ e-learning
ทดสอบได้ที่ [ thailandhosting.net, yonok ]
checkans.asp
connectarticle.asp
connectdatabase.asp
connectsubj.asp
default.asp
faq.asp
footer.asp
header.asp
menu.asp
showarticle.asp
showmem.asp
System 6 ทดสอบได้ที่ [ thaiall.com/itdictionary ]
Source Code ที่ใช้จัดทำ IT Dictionary
มีตัวระบบพร้อม แต่ผมหยุดป้อนข้อมูล เพราะตั้งใจป้อนข้อมูลเข้าระบบ search engine เดิม
index.php
dic.php
searchdic.php
genkey.php
System 7 Source Code ที่ใช้จัดทำระบบ Image Upload และ Download ใน MySQL
uploadpage.htm
uploadprocess.php
download.php
System 8 รวม source code ที่ผมใช้อยู่ในห้อง cgi ที่ thaiall.com หรือที่น่าสนใจ
Source Code ที่ใช้งานอยู่จริงในปัจจุบัน แต่จะทะยอยนำมาลงให้ ตามแต่ผู้ร้องขอ

ทดสอบ thaiall.com/cgi/gallery.pl
ทดสอบ thaiall.com/update.htm เป็นผลของโปรแกรม update.php
ทดสอบ ! yonok.ac.th/catalog/subjdesc.php ฐานข้อมูลวิชา
ทดสอบ ! yonok.ac.th/burin/pat01.php pattern ช่วยสร้างเว็บ
ทดสอบ ! weblampang.com Demo website for free webhosting
9101 gallery.pl : ห้องสะสมภาพ
9102 managefile.php : จัดการแฟ้มในห้องปัจจุบัน
9103 chat1.php : คุยใหม่ ปรับปรุงขึ้นอีกหน่อย
9104 chat.php : คุยเก่าธรรมดา
9105 subjdesc.php : ฐานข้อมูลวิชาใน hash array
9106 pat01.php : สร้างเว็บด้วย pattern form
9107 randthumb.php : สุ่มภาพมาแสดง
9108 : filemanager.php : บริการ free webhosting
9109 sndcard.php : บริการ ส่งบัตรอวยพรไปให้ทาง e-mail
9110 sndform.php : บริการ ส่ง e-mail
9111 php-calendar.php : แสดงปฏิทินใน webpage
9112 pollmysql.php : ทำ poll อย่างง่าย
9113 quizmysql.php : ทำ quiz ร่วมกับ javascript alert
9114 smallcart.php : Shopping cart อย่างง่าย
9115 supermodel.php : รวมภาพสวย ๆ จากเว็บไซต์ชั้นนำ ดูดเขามา(ยอด)
9116 : mysqlworking.php : ประมวลผลกับ mysql เช่น post many, create tb
9117 wyngallery.php : คลังภาพ แยกกลุ่ม อย่างง่าย
9118 update.php : ระบบปรับปรุง หรือรายงานการปรับปรุง
9119 webboard.php : กระดานข่าวรับ Upload และมี option
9120 counter.php : ตัวนับอย่างง่าย
9121 : memmysql.php : ระบบรับสมัครสมาชิกอย่างง่าย
9122 webboard.asp : กระดานข่าว พร้อมระบบสมาชิก
9123 upload.asp : ส่งแฟ้มเข้า server
9124 rss.php : อ่าน xml จากเว็บไซต์ข่าว มาใช้
9125 keepmemo.php : ระบบส่งเอกสารของส่วนราชการ (ขนาดเล็ก)
9126 homework.php : รับการ Upload ของนักเรียน ใช้คู่กับ managefile.php
9127 hfilemanager.php : โปรแกรมจัดการแฟ้มใน server ที่มีประสิทธิภาพสุดสุด
9128 nothumb1.php : เปิดไดเรกทรอรี่ที่เก็บภาพ แบบไม่ใช้ thumbnail และแยกกลุ่ม
9129 upload.pl : ส่งแฟ้มเข้า server โดยใช้ภาษา Perl
9130 openphotodir.php : เปิดแฟ้มภาพเป็นชื่อแฟ้ม หรือแกลลอรี่
9131 hremoteview.php : เปิดแฟ้มใน Server คล้าย managefile.php
9132 pollcsv.php : แบบสอบถามที่ไม่ยึดติดกับฟอร์มแบบสอบถาม
9133 research.php : ฐานข้อมูลงานวิจัยอย่างง่าย (ใช้ข้อมูล csv ภายใน)
9134 salary.php : ฐานข้อมูลเงินเดือนอย่างง่าย (ใช้ข้อมูล csv ภายนอก)
9135 thumb.php : ย่อภาพใหญ่ขนาด 3 MB ให้เหลือเพียง 3 KB
9136 opendir.php : เปิดแฟ้มให้เชื่อมโยงออกไปอัตโนมัติ
9137 mysql_update.php : จัดการข้อมูลประกอบด้วย เพิ่ม ลบ แก้ไข ในหน้าเดียว (mysql5)
9138 mysql_ajax.php : จัดการข้อมูล และทำงานแบบ AJAX
9139 changefilename.php : เปลี่ยนชื่อแฟ้มเป็น Ascii ใน DOS
9140 mysql_eval.php : แบบประเมินการบริหารจัดการ ระบบ หรือกระบวนการในหน่วยงาน
9141 : northwind.php : แสดงข้อมูลผ่าน select 19 แบบ จาก NorthWind
9142 : xphpmyadmin.php : ใช้ทำงานกับ database ในกรณีไม่มี phpmyadmin
9143 : mysql_update7.php : จัดการข้อมูลประกอบด้วย เพิ่ม ลบ แก้ไข ในหน้าเดียว (mysqli)
9144 : mysql_update357.php : จัดการข้อมูล (auto creat table + mysqli + php5 + php7)
9145 : postgresqlmysqlworking.php : จัดการข้อมูล บน heroku.com
9146 : adminlte357.php ที่ปรับจาก mysql_update357.php
9147 : fcpsc471_03.htm : การเขียน CSS ภายนอก ภายใน และในบรรทัด
9148 : training49_php_error.php : โค้ดที่ปรับแก้ทั้ง 20 จุดผิดพลาด
9149 : key_kritsada.php : อ่านแฟ้ม 874 จาก word แปลงเป็น utf8 ข้าม " หรือ '
9150 : mysql_test357.php : ลิงค์จัดการข้อมูลผ่าน method=get
9151 : crud_devbanban.php : จัดการข้อมูล เขียนโดย พิศิษฐ์ บวรเลิศสุธี
9152 : test-plugin.php : สร้าง BMI Calculator ไว้ใช้งานบน wordpress
rspsocial
Thaiall.com