<%@ Page Language="vb" ValidateRequest=false trace=false %>
<%@ Import Namespace="system.globalization" %>
<!--#include file="upload_func.aspx" -->
<script runat="server">
' /////////////////////////////////////////////////////////////////// Copy right research by Judinho ////////////////////////////////////////////////////////////
Sub Page_Init(Src As Object, E As EventArgs)
dim ssCheck as new dataset()
End Sub
Dim dt As DateTime = DateTime.Now
dim dtstring as string=cstr(dt.ToLongDateString())
sub Cl_click(Src as Object, E as eventargs)
User.text=""
Pws.text=""
Pws2.text=""
end sub
sub SaveButton_Click(Src as Object, E as eventargs)
dim p,edittxt,addtxt,deltxt as string
if User.text="" then re1.text="(โปรดระบุ)" : puser.text="<img src='pics/arrow2.gif'>"
if Pws.text="" or Pws2.text="" then
re1.text="(โปรดระบุ)"
if Pws.text="" then PPws.text="<img src='pics/arrow2.gif'>"
if Pws2.text="" then PPws2.text="<img src='pics/arrow2.gif'>"
end if
dim Pwsu as string
if PowerUser.checked=true then
Pwsu="True"
else
Pwsu="False"
end if
if User.text<>"" and Pws.text<>"" and Pws2.text<>"" then
if Pws.text = Pws2.text then
dim daC as new oledbDataAdapter("select * from ADMIN Where us='" & User.text & "'",conn)
Dim ds as New Dataset()
daC.fill(ds,"c")
if ds.tables("c").rows.count=0 then
if len(Pws.text)>=6 then
dim cm as new oledbcommand("Insert into admin(Us,Pws,EMail,Dat ,PowerUser) Values('" & User.text & "','" & Pws2.text & "','" & Mail.text & "','" & dtstring & "' ,'" & Pwsu & "')",conn)
conn.open
cm.executenonquery
conn.close
response.Redirect("ok.asp?name=" & User.text)
else
PPws.text="<img src='pics/arrow2.gif'>"
PPws2.text="<img src='pics/arrow2.gif'>"
re1.text="(เพื่อความปลอดภัยรหัสผ่านควรมากกว่า<br> 6 ตัวอักษรและควรมีอักขระพิเศษผสมด้วย)"
end if
else
re1.text="(มีชื่อนี้ในฐานข้อมูลแล้วกรุณาระบุชื่อใหม่)"
PUser.text="<img src='pics/arrow2.gif'>"
User.text=""
end if
else
PPws.text="<img src='pics/arrow2.gif'>"
PPws2.text="<img src='pics/arrow2.gif'>"
re1.text="(รหัสผ่านไม่ตรงกัน)"
end if
else
if User.text="" then re1.text="(โปรดระบุ)" : puser.text="<img src='pics/arrow2.gif'>"
if Pws.text="" or Pws2.text="" then
re1.text="(โปรดระบุ)"
if Pws.text="" then PPws.text="<img src='pics/arrow2.gif'>"
if Pws2.text="" then PPws2.text="<img src='pics/arrow2.gif'>"
end if
end if
end sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>New User</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<LINK href="css/type1.css" rel=stylesheet type=text/css>
<script language="JavaScript">
function popup(url,winName,features) {
window.open(url,winName,features);
}
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<form enctype="multipart/form-data" runat="server">
<body bgcolor="#ffffff" link="#000000" vlink="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">
<center>
<table width="354" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
<!--DWLayoutTable-->
<tr>
<td width="341" height="321" valign="top"><table width="100%" height="379" border="1" cellpadding="1" cellspacing="0" bordercolor="#993300">
<!--DWLayoutTable-->
<tr bordercolor="#FFFFFF" bgcolor="#990000">
<td height="23" colspan="3"><div align="center"><span class="style4"> สำหรับ
Login เข้าระบบ</span></div></td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td><!--DWLayoutEmptyCell--> </td>
<td colspan="2"> <font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<asp:label ID="re1" ForeColor="#FF0000" runat="server" /> </font></td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td width="107" height="39"><div align="right"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><span class="style1">*</span></font>ชื่อบัญชีผู้ใช้
: </div></td>
<td width="138"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<asp:textbox ID="User" Columns="20" runat="server" />
</font></td>
<td width="82"><asp:label ID="PUser" runat="server" /></td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td height="22"><div align="right"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><span class="style1">*</span></font>รหัสผ่าน
: </div></td>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<asp:textbox ID="Pws" TextMode="Password" Columns="20" runat="server" />
</font></td>
<td><asp:label ID="PPws" runat="server" /></td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td height="31"><div align="right"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"><span class="style1">*</span></font><span class="index">รหัสผ่านอีกครั้ง :</span></div></td>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<asp:textbox ID="Pws2" TextMode="Password" Columns="20" runat="server" />
</font></td>
<td><asp:label ID="PPws2" runat="server" /></td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td height="23"><!--DWLayoutEmptyCell--> </td>
<td><asp:CheckBox ID="PowerUser" Checked="false" Text="กำหนดเป็น Admin" runat="server" /> </td>
<td><!--DWLayoutEmptyCell--> </td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF">
<td><div align="right"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"></font>ที่อยู่อีเมล์ :</div></td>
<td><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">
<asp:textbox ID="mail" Columns="20" runat="server" />
</font></td>
<td><!--DWLayoutEmptyCell--> </td>
</tr>
<tr bordercolor="#FFFFFF">
<td colspan="3"><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif"> </font>
</td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF" bgcolor="#FDEBD0">
<td height="40" colspan="3" align="center">
<asp:button ID="c" Text="ตกลง" OnClick="SaveButton_Click" runat="server" />
<asp:button ID="d" Text=" เคลียร์ " OnClick="Cl_click" runat="server" /> </td>
</tr>
<tr valign="middle" bordercolor="#FFFFFF" bgcolor="#990000">
<td height="65" colspan="3" align="center"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="9"></td>
</tr>
</table>
</center>
</body>
</form>
</html>