'act_member.asp
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<!--#include file="getuploaddata.asp"-->
<!--#include file="connect.asp"-->
<%
if uploaddata.Item("name").Item("value")="" or _
uploaddata.Item("surname").Item("value")="" or _
uploaddata.Item("address").Item("value")="" or _
uploaddata.Item("province").Item("value")="" or _
uploaddata.Item("phone").Item("value")="" or _
uploaddata.Item("email").Item("value")="" or _
uploaddata.Item("username").Item("value")="" or _
uploaddata.Item("password").Item("value")="" or _
uploaddata.Item("question").Item("value")="" or _
uploaddata.Item("answer").Item("value")="" then
response.write"<center><input type=button class=input_button3 value='กรอกข้อมูลไม่ครบ กลับไปกรอกข้อมูลใหม่ !!' onClick='history.go(-1)' ></center>"
else
filename_new="file\"&filename_new
userid = session("username")
sql2 = "Select * from member where username='"&uploaddata.Item("username").Item("value")&"'"
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open sql2, conn, 1,3,512
response.write(sql2)
if (Rs1.EOF) Then
sql="select * from member"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 1,3
if rs.recordcount <> 0 then
rs.addnew
rs("name")=uploaddata.Item("name").Item("value")
rs("surname")=uploaddata.Item("surname").Item("value")
rs("address")=uploaddata.Item("address").Item("value")
rs("province_id")=uploaddata.Item("province").Item("value")
rs("phone")=uploaddata.Item("phone").Item("value")
rs("mobile")=uploaddata.Item("mobile").Item("value")
rs("e_mail")=uploaddata.Item("email").Item("value")
rs("picture")=filename_new
rs("username")=uploaddata.Item("username").Item("value")
rs("password")=uploaddata.Item("password").Item("value")
rs("question")=uploaddata.Item("question").Item("value")
rs("answer")=uploaddata.Item("answer").Item("value")
rs.Update
With Response
.Write "<br><br><table align=center width=400 cellspacing=0 cellpadding=0 bgcolor=#ff6600><tr><td>"
.Write "<table align=center border=0 width='100%' cellpadding=1 cellspacing=1>"
.Write "<tr><td bgcolor=#ffffcc align=center>"
.Write "<b>Status : </b> <IMG SRC=picturs/icon_mini_register.gif >บันทึกข้อมูลเข้าสู่ระบบเรียบร้อยแล้ว "
.Write "</td></tr></table>"
.Write "</td></tr></table>"
End With
rs.close
else
end if
else
With Response
.Write "<br><br><table align=center width=400 cellspacing=0 cellpadding=0 bgcolor=#ff6600><tr><td>"
.Write "<table align=center border=0 width='100%' cellpadding=1 cellspacing=1>"
.Write "<tr><td bgcolor=#ffffcc align=center>"
.Write "<b>Status : </b> มีผู้ใช้ชื่อ user name นี้แล้ว"
.Write "</td></tr></table>"
.Write "</td></tr></table>"
End With
rs1.close
end if
end if
%>
<table width="200" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="right" bgcolor="#66CCFF"> </td>
</tr>
<tr>
<td align="right" bgcolor="#66CCFF"><font size="2"> <font color="#FF0000"><a href="javascript:self.close();" ><font size="3">close
windows </font></a></font></font></td>
</tr>
'connect.asp
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="&Server.MapPath("data.mdb")
%>
'=========================================================
'getuploaddata.asp
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%
'-- ฟังค์ชั่นเปลี่ยน ข้อความ เป็น ข้อมูลไบนารี --
Function TextToBinary(text)
for i = 1 to Len(text)
character = mid(text,i,1)
TextToBinary = TextToBinary & ChrB(Asc(character))
next
End Function
'-- ฟังค์ชั่นเปลี่ยน ข้อมูลไบนารี กลับเป็น ข้อความ --
Function BinaryToText(Binary)
BinaryToText=""
for i =1 to LenB(Binary)
character = MidB(Binary,i,1)
BinaryToText = BinaryToText & Chr(AscB(character))
next
End Function
'-- กำหนดการใช้ Dictionary ทำให้เก็บข้อมูลได้มากคล้ายกับ Array --
set uploaddata = CreateObject("Scripting.Dictionary")
data = request.BinaryRead(request.TotalBytes)
posend = InstrB(1,data,TextToBinary(chr(13)))
header = MidB(data,1,posend-1)