⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timesheetloginscript.wsc

📁 Windows Web脚本开发指南/(美) Dan Heflin, Todd Ney著 的源码
💻 WSC
字号:
<?xml version="1.0"?>
<component>

<registration
	description="TimesheetLoginScript"
	progid="TimesheetLoginScript.WSC"
	version="1.00"
	classid="{a7884700-b74c-11d3-8e91-00207810a287}"
>
</registration>

<public>
	<property name="userCaption">
		<get/>
		<put/>
	</property>
	<property name="passwordCaption">
		<get/>
		<put/>
	</property>
	<property name="maxUserSize">
		<get/>
		<put/>
	</property>
	<property name="maxPasswordSize">
		<get/>
		<put/>
	</property>
	<property name="userID">
		<get/>
		<put/>
	</property>
	<property name="userName">
		<get/>
	</property>
	<property name="loginCaption">
		<get/>
		<put/>
	</property>
	<property name="loginWidth">
		<get/>
		<put/>
	</property>
	<property name="submitButtonCaption">
		<get/>
		<put/>
	</property>
	
	<method name="validateUser">
	</method>
	<method name="buildLogin">
	</method>
</public>

<implements type="ASP" id="ASP"/>

<script language="JScript">
<![CDATA[

var description = new TimesheetLoginScript;

function TimesheetLoginScript()
{
	this.get_userCaption = get_userCaption;
	this.put_userCaption = put_userCaption;
	this.get_passwordCaption = get_passwordCaption;
	this.put_passwordCaption = put_passwordCaption;
	this.get_loginCaption = get_loginCaption;
	this.put_loginCaption = put_loginCaption;
	this.get_loginWidth = get_loginWidth;
    	this.put_loginWidth = put_loginWidth;
	this.get_maxUserSize = get_maxUserSize;
	this.put_maxUserSize = put_maxUserSize;
	this.get_maxPasswordSize = get_maxPasswordSize;
	this.put_maxPasswordSize = put_maxPasswordSize;
	this.get_loginCaption = get_loginCaption;
	this.put_loginCaption = put_loginCaption;
	this.get_submitButtonCaption = get_submitButtonCaption;
	this.put_submitButtonCaption = put_submitButtonCaption;
	this.get_userID = get_userID;
	this.put_userID = put_userID;
	this.get_userName = get_userName;
	this.validateUser = validateUser;
	this.buildLogin = buildLogin;
}

var userCaption = "User ID:";
var passwordCaption = "Password:";
var userID = "";
var userName;
var loginCaption = "Enter Your User-ID and Password:";
var maxUserSize = 10;
var maxPasswordSize = 10;
var submitButtonCaption = "Login";
var loginWidth = "100%";

function get_userCaption()
{
	return userCaption;
}

function put_userCaption(newValue)
{
	userCaption = newValue;
}

function get_passwordCaption()
{
	return passwordCaption;
}

function put_passwordCaption(newValue)
{
	passwordCaption = newValue;
}

function get_userID()
{
	return userID;
}

function put_userID(newValue)
{
	userID = newValue;
}

function get_userName()
{
	return userName;
}

function get_loginCaption()
{
	return loginCaption;
}

function put_loginCaption(newValue)
{
	loginCaption = newValue;
}


function get_loginWidth()
{
	return loginWidth;
}

function put_loginWidth(newValue)
{
	loginWidth = newValue;
}

function get_maxUserSize()
{
	return maxUserSize
}

function put_maxUserSize(newValue)
{
	maxUserSize = newValue;
}

function get_maxPasswordSize()
{
	return maxPasswordSize;
}

function put_maxPasswordSize(newValue)
{
	maxPasswordSize = newValue;
}

function get_submitButtonCaption()
{
	return submitButtonCaption;
}

function put_submitButtonCaption(newValue)
{
	submitButtonCaption = newValue;
}

function validateUser()
{
  var conn = Server.CreateObject("ADODB.Connection");
  var path = Server.MapPath("db") + "\\timesheet.mdb";
  var password = Request.Form("txtPassword");
  userID = Request.Form("txtUserID");
    
  conn.Open("Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" + path + ";");
  sql = "select UserName from Users where UserID = '" + userID;
  sql += "' and Password = '" + password + "'";
  var rs = conn.Execute(sql);
  if (rs.EOF){
    return false;  
  }
  else{
    userName = rs(0);
    return true;
  }  
}

function buildLogin()
{
  Response.Write(loginCaption);
  Response.Write("<table border='0' width='" + loginWidth + "'>");
  Response.Write("<tr><td>" + userCaption + "</td>");
  Response.Write("<td><input type='text' name='txtUserID' size='" + maxUserSize + "' maxLength='" + maxUserSize + "' value='" + userID + "'></td></tr>");
  Response.Write("<tr><td >" + passwordCaption + "</td>");
  Response.Write("<td><input type='password' name='txtPassword' size='" + maxPasswordSize + "' maxLength='" + maxPasswordSize + "'></td></tr>");
  Response.Write("<tr><td colspan='2' align='center'><input type='submit' value='" + submitButtonCaption +"'></td></tr></table>");
}

]]>
</script>

</component>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -