thaiall logomy background
coding : update.asp.
my town
Source : Perl | PHP | ASP | JSP | HTML | HTML5 | JavaScript | Java | COBOL | C++ | MS Access | VBNet | VB | Python | โค้ดดี
File : update.asp. ID : 4212
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Full
<! version 2.24July46 by burin rujjanapan from yonok.ac.th>
<!--#include file="connectinfo.asp"-->
<%
if len(session("usertb")) < 3 or request.form("process") = "SignIn" then
  sql = "select * from tb where tbid = '"& request.form("usertb")&"' and tbpassword = '"&request.form("passwordtb") &"'"
  set rs = server.createobject("ADODB.recordset")
  rs.open sql,connect,1,3
  tots = rs.recordcount
  u = "x"
  p = "x"
  if tots > 0 then  
    u = request.form("usertb")
    p = request.form("passwordtb")
  end if
end if
'
if request.form("process") = "SignOut" then
  session("usertb") = ""
  session("passwordtb") = ""
  u = "x"
  p = "x"  
end if
'
if request.form("process") = "SignIn" _
  and request.form("usertb") = u and request.form("passwordtb") = p then  
  session("usertb") = request.form("usertb")
  session("passwordtb") = request.form("passwordtb")
end if  
'
%>

<!--#include file="header.asp"-->
<table width=100% bgcolor=black><td bgcolor=#ffffdd>
<%
if len(session("usertb")) = 0 then
  response.write("<center><table width=300><tr><form action=update.asp method=post><td align=right>")
  response.write("รหัสตำบล (tbid)</td><td><input name=usertb value="& session("usertb") &"></td></tr><tr><td align=right>")
  response.write("รหัสผ่าน (tbpassword)</td><td><input name=passwordtb type=password></td></tr>")
  response.write("<tr><td></td><td><input type=submit name=process value=SignIn>")
  response.write("</td></tr></form></table>")
else 
  response.write("<font size=4>ผู้ที่อยู่ในระบบขณะนี้ : <a href=http://202.29.78.31/tb.asp?tumbon=" & session("usertb") & "&menu=m00 target=_blank><b>"& session("usertb") & "</b></a></font>")
  response.write("<table width=300><form action=update.asp method=post><td align=center><hr color=black>กดปุ่มล่างนี้ ถ้าต้องการเลิกการทำงาน<br>")
  response.write("<input type=submit name=process value=SignOut></td>")
  response.write("</form></table>")
end if
%>
</td><td><font color=white><b>บริการฐานข้อมูลสำหรับอำเภอ และตำบล</b><br>(ต้องใช้รหัสตำบล และรหัสผ่าน เพื่อเข้าไปแก้ไขข้อมูล)<br>
งาน 1. เรียกข้อมูลตำบล และตัวเลือกมาแก้ไข<br>
งาน 2. ขอแก้ไขรายละเอียดข้อมูลของเมนู<br>
งาน 3. ขอเพิ่มรายละเอียดข้อมูลของเมนู<br>
งาน 4. ขอลบรายละเอียด ในเมนูของตำบล
</td></table>
<center>
<%
if request.form("process") = "AddData" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  if (len(request.form("fm")) = 0 or len(request.form("fmdesc")) = 0) then
    response.write("<form action=update.asp method=post><input type=submit value=กลับหน้าแก้ไขอีกครั้ง></form><hr color=black>")
  else  
	sql = "insert into tbm(tbid,m,mdesc) values ('"& session("usertb") &"','"
    sql = sql & request.form("fm") &"','"& request.form("fmdesc") &"')"
   connect.execute(sql)
    response.write("<br>AddData : ok")  
  end if
end if  
'
if request.form("process") = "DelData" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  sql = "select * from tbm where tbid = '"& session("usertb") &"' and m = '"&request.form("fm") &"'"
  set rs = server.createobject("ADODB.recordset")
  rs.open sql,connect,1,3
  tots = rs.recordcount
  if tots = 0 then
    response.write("<form action=update.asp method=post><input type=submit value=กลับหน้าแก้ไขอีกครั้ง></form><hr color=black>")
  else    
    sql = "delete from tbm where tbid = '"& session("usertb") &"' and m = '"&request.form("fm") &"'"
    connect.execute(sql)
    response.write("<br>DelData : ok")  
  end if
end if 
'
if request.form("process") = "EditMenuStep1" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  sql = "select * from tb where tbid = '"& session("usertb") &"'"
  set rs = server.createobject("ADODB.recordset")
  rs.open sql,connect,1,3
  tots = rs.recordcount
  if tots = 0 then
    response.write("<form action=update.asp method=post><input type=submit value=กลับหน้าแก้ไขอีกครั้ง></form><hr color=black>")
  else  
    response.write("<br><table width=95% border=0 cellpadding=1 cellspacing=1 bgcolor=blue><td bgcolor=#dddddd>")  
    response.write("<form action=update.asp method=post><font color=blue size=4><b>งาน 1. แก้ไขรายละเอียด และข้อมูลหน้าแรก</b></font><br>")
    response.write("<table width=100% border=0 cellpadding=1 cellspacing=1 bgcolor=#dddddd><tr bgcolor=#808080><td align=right>")
    response.write("รหัสตำบล (tbid) : </td><td>" & session("usertb") &"<input name=ftbid type=hidden value="& session("usertb") &"></td></tr><tr><td align=right>")
    response.write("รหัสผ่าน (tbpassword)  : </td><td><input name=ftbpassword size=40 value="& rs("tbpassword") &"></td></tr><tr bgcolor=#808080><td align=right>")
    response.write("ชื่อ (name) : </td><td><input name=fname size=40 value="& rs("name") &"></td></tr><tr><td align=right>")  
    response.write("Web address (url) : </td><td><input name=furl size=40 value="& rs("url") &"> เช่น http://www.yonok.ac.th</td></tr><tr bgcolor=#808080><td align=right>")  
    response.write("จำนวนข่าวแจ้งต่อหน้า (linenews) : </td><td><input name=flinenews size=5 value="& rs("linenews") &"> ต้องเป็นตัวเลข</td></tr><tr><td align=right>")  	
    response.write("หน้าแรกของตำบล (m00) :</td><td><textarea name=fm00 rows=15 cols=100>"& rs("m00") &"</textarea></td></tr><tr bgcolor=#ddffdd><td align=right valign=top>")   
    response.write("ชื่อเมนูทั้งหมด (m..) : <br>ใช้ -- เมื่อต้องการลบตัวเลือก</td><td>")   
    response.write("<ul>")
    for j = 1 to 99
      if j < 10 then
        l = "m0" & j
        k = rs("m0"& j)		
      else
        l = "m" & j
        k = rs("m"& j)		           
      end if
      if isnull(k) then
        k = "-"
      end if
      response.write("Menu (" & l & ") <input name=f"& l & " size=60 value='"& k &"'><br>")
    next 
    response.write("</ul><input type=submit name=process value=EditMenuStep2> เพื่อบันทึกรายการเมนูทั้ง 99 รายการด้านบน")
    response.write("</td></tr>")	
    response.write("</table></form></td></table><hr color=red><br>")  
  end if	
end if 
'
if request.form("process") = "EditMenuStep2" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  sql = "update tb set tbid = '"& session("usertb") &"',"
  sql = sql & " name = '"&request.form("fname") &"',"  
  sql = sql & " tbpassword = '"&request.form("ftbpassword") &"', "  
  if request.form("furl") <> "" then  sql = sql & " url = '"&request.form("furl") &"', "  
  if request.form("flinenews") <> "" then  sql = sql & " linenews = '"&request.form("flinenews") &"', "    
  for j = 0 to 99
    if j < 10 then
      l = "m0" & j
    else
      l = "m" & j
    end if
    if request.form("f"&l) <> "-" then
      sql = sql & l & "= '" & request.form("f"&l) &"' "  
      if (j + 1) < 10 then
        nextl = "m0" & (j + 1)
      else
        nextl = "m" & (j + 1)
      end if
      if j < 99 and request.form("f"&nextl) <> "-" then
        sql = sql & ","		
      end if
    end if
  next    
  sql = sql & " where tbid = '"& request.form("ftbid")&"'" 
  connect.execute(sql)
  response.write("<br>EditData : ok")  
end if 
'
if request.form("process") = "EditDataStep1" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0 then  
  sql = "select * from tbm where tbid = '"& session("usertb") &"' and m = '"&request.form("fm") &"'"
  set rs = server.createobject("ADODB.recordset")
  rs.open sql,connect,1,3
  tots = rs.recordcount
  if tots = 0 then
    response.write("<form action=update.asp method=post><input type=submit value=กลับหน้าแก้ไขอีกครั้ง></form><hr color=black>")
  else
    response.write("<form action=update.asp method=post><b>ขอแก้ไขรายละเอียด</b> (ขั้นสุดท้าย)<br>")
    response.write("รหัสตำบล (tbid) : " & session("usertb") &"<input name=ftbid type=hidden value="& session("usertb") &"><br>")
    response.write("รหัสเมนูที่ (m) : " & request.form("fm") &"<input name=fm type=hidden value="& request.form("fm") &"><br>")  
    response.write("รายละเอียด (mdesc) : <br>")
    response.write("<textarea name=fmdesc rows=20 cols=100>")
    response.write(rs("mdesc"))	
    response.write("</textarea><br> ")  
    response.write("<input type=submit name=process value=EditDataStep2>")
    response.write("</form><hr>")  
  end if
end if 
'  
if request.form("process") = "EditDataStep2" _
  and len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  sql = "update tbm set mdesc = '"& request.form("fmdesc") &"' where tbid = '"& request.form("ftbid")&"' and m = '"&request.form("fm") &"'" 
  connect.execute(sql)
  response.write("<br>EditData : ok")  
end if 

' Form 1 เรียกข้อมูลตำบล และตัวเลือกมาแก้ไข
if len(session("usertb")) > 0 and len(session("passwordtb")) > 0 and request.form("process") <> "EditMenuStep1" then
  response.write("<table width=95% border=0 cellpadding=1 cellspacing=1 bgcolor=blue><td bgcolor=#dddddd>")
  response.write("<form action=update.asp method=post><font size=4 color=blue><b>งาน 1. เรียกข้อมูลตำบล และตัวเลือกมาแก้ไข</b> (นี่คือขั้นที่ 1 ซึ่งทั้งหมดมี 2 ขั้นตอน)</font><ul> ")
  response.write("ให้ click ปุ่มข้างขวานี้เพื่อเข้าสู่กระบวนการแก้ไข <input type=submit name=process value=EditMenuStep1>")
  response.write("</form></ul>")
  response.write("</td></table><br>")  
end if  

' Form 2 ขอแก้ไขรายละเอียดข้อมูลของเมนู
if len(session("usertb")) > 0 and len(session("passwordtb")) > 0 and request.form("process") <> "EditDataStep1" then
  response.write("<table width=95% border=0 cellpadding=1 cellspacing=1 bgcolor=blue><td bgcolor=#dddddd>")
  response.write("<form action=update.asp method=post><font size=4 color=blue><b>งาน 2. ขอแก้ไขรายละเอียดข้อมูลของเมนู</b> (นี่คือขั้นที่ 1 ซึ่งทั้งหมดมี 2 ขั้นตอน)</font><ul>")
  response.write("รหัสเมนูที่ (m) : <input name=fm value=m01>เช่น m01 ถึง m99 เพราะ m00 อยู่ในงานแรกแล้ว<br>")
  response.write("<input type=submit name=process value=EditDataStep1>")
  response.write("</form></ul>")
  response.write("</td></table><br>")  
end if  

' Form 3 ขอเพิ่มรายละเอียดข้อมูลของเมนู
if len(session("usertb")) > 0 and len(session("passwordtb")) > 0  then  
  response.write("<table width=95% border=0 cellpadding=1 cellspacing=1 bgcolor=blue><td bgcolor=#dddddd>")
  response.write("<form action=update.asp method=post><font size=4 color=blue><b>งาน 3. ขอเพิ่มรายละเอียดข้อมูลของเมนู (ที่ยังไม่เคยเพิ่มเข้าไป)</b></font><ul>")
  response.write("รหัสเมนูที่ (m) : <input name=fm>เช่น m01 ถึง m99<br>")
  response.write("รายละเอียด (mdesc) : <font color=red>(Can not duplicate and Can not use ' )</font><br>")
  response.write("<textarea name=fmdesc rows=10 cols=100>")
  response.write("</textarea><br>")
  response.write("<input type=submit name=process value=AddData>")
  response.write("</form>")
  response.write("<b>ตัวอย่าง code ที่อาจต้องใช้</b><ul><font color=blue>")  
  response.write("&lt;img src=http://www.yonok.ac.th/pic/yonok.jpg&gt;<hr color=yellow>")    
  response.write("&lt;a href=http://www.lampang.net&gt;ลำปาง&lt;/a&gt;<hr color=yellow>") 
  response.write("&lt;table bgcolor=yellow border=1 width=300&gt;<br>")   
  response.write("&lt;tr&gt;&lt;td&gt;ตัวอย่าง code สร้างตาราง&lt;/td&gt;&lt;td&gt;รับได้หลาย ๆ บรรทัดarea2&lt;/td&gt;&lt;/tr&gt;<br>")   
  response.write("&lt;tr&gt;&lt;td&gt;ข้อมูลอะไรที่นี่&lt;/td&gt;&lt;td&gt;ใส่ img ก็รับ&lt;/td&gt;&lt;/tr&gt;<br>")     
  response.write("&lt;/table&gt;<hr color=yellow>")
  response.write("&lt;script&gt;window.open(&#34;http://www.thaiall.com/me/picme.jpg&#34;);&lt;/script&gt;<hr color=yellow>")
  response.write("&lt;iframe src=http://10.7.4.31/users/burin/hello.doc width=400 height=400 &gt;&lt;/iframe&gt;<hr color=yellow>")
  response.write("&lt;ol&gt;สารบัญ<br>")
  response.write("&lt;li&gt;&lt;a href=http://10.7.4.31/users/govoffice/file1.doc&gt;รายชื่อพนักงาน&lt;/a&gt;<br>") 
  response.write("&lt;li&gt;&lt;a href=http://10.7.4.31/users/govoffice/file2.doc&gt;การใช้จ่ายงบประมาณมีนาคม46&lt;/a&gt;<br>") 
  response.write("&lt;li&gt;&lt;a href=http://10.7.4.31/users/govoffice/file3.doc&gt;การใช้จ่ายงบประมาณมีนาคม47&lt;/a&gt;<br>") 
  response.write("&lt;/ol&gt;")
  response.write("</font></ul></ul>") 
  response.write("</td></table><br>")  

' Form 4 ขอลบรายละเอียดในเมนูของตำบล
  response.write("<table width=95% border=0 cellpadding=1 cellspacing=1 bgcolor=blue><td bgcolor=#dddddd>")
  response.write("<form action=update.asp method=post><font size=4 color=blue><b>งาน 4. ขอลบรายละเอียด ในเมนูของตำบล</b></font><ul>")
  response.write("รหัสเมนูที่ (m) : <input name=fm>เช่น m01 ถึง m99<br>")
  response.write("<input type=submit name=process value=DelData>")
  response.write("</form></ul>") 
  response.write("</td></table>")
  connect.close
  set rs = nothing
  set connect = nothing
else 
  if len(session("usertb")) > 0 then
    response.write("<br>Invalid account")
  end if
end if
%>
<!--#include file="footer.asp"-->
</body></html>
จำนวน : 243 บรรทัด
าษาเฮชทีเอ็มแอล (HTML = HyperText Markup Language) คือ ภาษาคอมพิวเตอร์ที่ออกแบบมาเพื่อใช้ในการสร้างเว็บเพจที่เรียกดูผ่านทางเว็บเบราว์เซอร์ (Web Browser) เริ่มพัฒนาโดย ทิม เบอร์เนอรส์ ลี (Tim Berners Lee) ในปัจจุบัน HTML ล่าสุดคือ รุ่น 5 เป็นมาตรฐานหนึ่งของ ISO ซึ่งจัดการโดย World Wide Web Consortium (W3C) ในปัจจุบัน ทาง W3C ผลักดัน รูปแบบของ HTML แบบใหม่ ที่เรียกว่า XHTML รุ่นแรกคือ 1.0 (ม.ค.2543) ซึ่งมีโครงสร้างเป็นแบบ XML (eXtensible Markup Language)
าษาพีเอชพี (PHP Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้กับ ตัวแปลภาษา ทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปเอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้
าษาไพทอน (Python Language) คือ ภาษาคอมพิวเตอร์ประเภทโอเพนท์ซอร์ท (Open Source Computer Language) สำหรับพัฒนาแอพพลิเคชั่นโดยไม่ยึดติดกับแพลตฟอร์ม (Platform) และใช้ในงานได้หลายประเภท ทั้งใช้ในการประมวลผลผ่านคอมมานด์ไลน์ หรือเป็นเว็บเพจแบบไดนามิก เมื่อเครื่องบริการได้รับคำร้องจากผู้ใช้ก็จะส่งให้โค้ดให้กับตัวแปลภาษา เพื่อทำหน้าที่ประมวลผลและส่งข้อมูลกลับไปยังเครื่องของผู้ใช้ที่ร้องขอ ในรูปข้อความ เอชทีเอ็มแอล ภาพ หรือแฟ้มดิจิทอลอื่นใด ลักษณะของภาษามีรากฐานคำสั่งมาจากภาษาซี เป็นภาษาที่สามารถพัฒนาให้ใช้งานแบบโต้ตอบกับผู้ใช้ได้ จุดที่แตกต่างกับภาษาอื่น คือ การรวบรวมจุดเด่นของแต่ละภาษามารวมเข้าด้วยกัน
อสคิวแอล (SQL = Structured Query Language) คือ ภาษาสอบถามข้อมูล หรือภาษาจัดการข้อมูลอย่างมีโครงสร้าง มีการพัฒนาภาษาคอมพิวเตอร์ และโปรแกรมฐานข้อมูลที่รองรับมากมาย เพราะจัดการข้อมูลได้ง่าย เช่น MySQL, MariaDB, MsSQL, PostgreSQL หรือ MS Access เป็นต้น สำหรับโปรแกรมฐานข้อมูลที่ได้รับความนิยมคือ MySQL หรือ MariaDB เป็น Open Source ที่ใช้งานได้ทั้งใน Linux และ Windows
วัสดีชาวโลก (Hello World) คือ ผลลัพธ์ครั้งแรกที่นักพัฒนาโปรแกรมนิยมเลือกใช้แสดงผลในโปรแกรมแรกที่เขียนขึ้นเพื่อทดสอบการทำงาน ข้อความนี้ทำให้นึกถึงมนุษย์ต่างดาวที่มาเยือนโลกและกล่าวกับมนุษย์เมื่อพบกันครั้งแรกในภาพยนตร์
ตัวอย่าง Hello World
ปรับปรุงโปรแกรม source.pl : 2565-07-24
rspsocial
Thaiall.com