1

zhaozj2021-02-16  88

Function Source Code: <% Function IsValidemail (Email) Validflag = Falseif (Email <> ") and (Instr (1, Email," @ ")> 0) And (INSTR (1, Email,")> 0 ) Tenatcount = 0specialflag = falsefor atloop = 1 to len (email) ATCHR = MID (email, atloop, 1) if atchr = "@" Then Atcount = atcount 1if (atchr> = chr (32)) and (atchr <= CHR (44)) THEN SPECIALFLAG = Trueif (atchr = chr (47)) or (atchr = chr (96)) or (atchr> = chr (123)) Then specialflag = trueif (atchr> = chr (58)) and (atChr <= Chr (63)) Then SpecialFlag = TrueIf (atChr> = Chr (91)) And (atChr <= Chr (94)) Then SpecialFlag = TrueNextIf (atCount = 1) And (SpecialFlag = False) ThenBadFlag = FalsetAry1 = Split (email, "@") UserName = tary1 (0) DomainName = tary1 (1) IF (username = ") or (domainname =") THEN BADFLAG = TRUEIF MID (DomainName, 1, 1) = ". . "then BadFlag = TrueIf Mid (DomainName, Len (DomainName), 1) =" "then BadFlag = TrueValidFlag = TrueEnd IfEnd IfIf BadFlag = True Then ValidFlag = FalseIsValidEmail = ValidFlagEnd Function%> usage example: isValidEmail (" my_263_email @ 2 63.NET ") Returns TureSvalideMail (" zh99wj@tonghua.com) Returns TureSvalideMail ("MyEmail263.net") Returns falsesvalideMail ("My_263_email @ 263) Returns false4. Script Encoder is free. The encryption software can download from Microsoft website: http://msdn.microsoft.com/scripting/vbscript/download/x86/sce10en.exe. After download, run the installation.

ASP is based on Windows NT 4.0, Windows 9x dynamic site design technology, we can create dynamic, interactive, high-performance web applications.

Compared to traditional dynamics, ASP has direct and HTML integration, easy to create, no need to manually compile, object-oriented, and easy to make functional extensions such as Active Server Component, so there is a good future in enterprise Internet / intranet applications. . However, for different business logic, we need to improve the business computing power of the ASP page through the homemade functional components, improve software architectures. The specific practices are as follows: ■ Use homemade function components objects in the ASP page

As an integral part of IIS, the ASP provides an integrated development environment that does not need to be compiled. Developers can combine HTML, VBScript, or JScript, ASP scripts, and ActiveX components, thereby establishing a dynamic, powerful web application system. . The ASP script is equivalent to the adhesive, bonding a component having a specific function to form a final software product. While ASP provides a lot of built-in objects and components, for complex business applications, it is necessary to develop component objects with certain characteristics according to business requirements to complete special tasks. We can develop the following two types of components objects using Visual C , Visual Basic, Delphi, and Java:

1. The dll file being packaged is called the ActiveX DLL. After registering through the registrar, you can be referenced by the "SET Object Name = Class Name" in the ASP script. Objects In this process, it is run in the background of the server, and the resulting result is automatically generated by the system to the front-end browser. This class is used to handle business logic calculations, and is often referred to as transaction logic units.

2. Generate ocx files, generally used as visualized objects, called ActiveX Control. Usually the components are created and packaged by download, they will be brought into cab files, and we can embed it directly in the .ASP home page. Use the HTML language tag to be referenced when inserted in the page. Objects must be downloaded from the server under this usage mode, then run on the client's browser. The first download is deployed to be related to the relevant .dll and the ocx file for local installation registration. When you are reused in the future, you can get it directly, you don't have to download each time you repeatedly. This class is often used to perform information in the front-end browser to complete the performance and display tasks.

■ Use MTS build a practical three-layer architecture

In the Browser Customer / Web Application Server / Database Server structure system, IIS only provides multi-threaded support for the page, not responsible for the management of components. Multiple users simultaneously access an ASP page embedded in an ActiveX DLL component, it is bound to cause congestion of the server-side network, resulting in a decline in system performance. In order to effectively support multi-user access to components, Microsoft introduces the MTS (Microsoft Transaction Server "transaction server. MTS is a powerful development environment that provides an application programming model and an application-based environment based on a distributed, component-based application, which can easily develop and configure high performance, measured And reliable Internet and Intranet enterprise applications. It provides a number of services such as data connection buffer, thread management, and transaction management, well solved a series of issues such as multi-client use of components to access the background database. IIS is responsible for page service and management, MTS is responsible for the service and management of embedded components in the page, and the two combine together to form an intermediate layer application server to construct a practical three-layer architecture.

Installing the software environment required for MTS for Microsoft Windows NT 4.0 or higher, or installed Windows 9x with DCOM (Windows 9X's DCOM support is installed by IE4.0). If you are in a Windows NT environment, you must first install Windows NT Service Pack 3 or later, and then use Windows NT 4.0 Option Pack to install MTS. If you want the component to access the database, you need to use Microsoft SQL Server 6.5 or higher. If you plan to create an Internet application, the server should use IIS4.0 or higher, and the client uses IE4.0 or higher. MTS has intuitive interface and is very simple to operate. The general steps to add components to MTS are as follows:

1. Create an ActiveX DLL with a tool language that supports development ActiveX;

2. Register the developed ActiveX components;

3. Enter Transaction Server Explorer, create empty packages using the Install Package option;

4. Open the component group of the empty package, join the registered ActiveX DLL.

5. Use this ActiveX DLL in the ASP page;

6. Adjust the service parameters of the registrar to adapt to the needs of the actual application.

Thereafter, when the component is called again, the MTS will automatically take over the request from the client and provide a unified service.

The function of the family class programmers tutorial VBScript: ominous date: 2004-2-12 23:38:00

-------------------------------------------------- ------------------------------ 1, how do I add a date on a date?

Dateadd (Interval, Number, Date)

parameter

Interval must option. String expressions indicate the time interval to be added. Number must option. Numerical expression indicates the number of time intervals to be added. Numerical expressions can be positive (getting a date) or a negative number (obtained by the past). Date must option. VARIANT or the text of the representation of Interval.

The interval parameter can have the following values:

YYYY Year Q Quarter M Month Y Year Day D Japanese W Week WW Zhou H H / Nice N minutes s

Example: Date = DateAdd ("M", 1, "31-01-2004") The result is the result of February 31, 2004? Oh, not, is February 29, 2004, DateAdd () will not return the date of the wrong

2, how do I get two time intervals?

Datediff (Interval, Date1, Date2)

parameter

Interval must option. String expressions indicate time intervals for calculating DATE1 and DATE2. Date1, Date2 must be selected. Date expression. Two dates used to calculate.

The interval parameter can have the following values:

Set Description YYYY Q quarter N month Y Year day number D day W One week of the day WW week h hours m minutes s second

Example: DIFFDATE = Datediff ("D", Now, "31-01-2004")

3, how do I accurate my calculation?

FormatNumber (Expression [, NumdigitsAfterDecimal [, includeEleadingDigit [, useparensfornegativenumbers [, groupdigits]]]) Parameter Expression must option. To be formatted expression. NumdigitsAfterDecimal option. Indicates the value of the number of digits on the right side of the decimal point. The default is -1, indicating the area setting of the computer. IncludeEadingDigit options. Three-state constants indicate whether to display zero in front of the small numerical decimal point. UseParensfornegativeNumbers options. The tri-state constant indicates whether the negative value is placed in parentheses. GroupDigits option. Three-state constants indicate whether digital packets specified in the computer zone settings will group numbers. Setting includeEleadingDigit, useparensfornegativeNumbers and GroupDigits parameters can have the following values:

Constant Value Description TristateTrue -1 True TristateFalse 0 false TristateUsedefault -2 Using the settings in your computer zone settings.

Example: The 1/3 formatted to four decimals, format formatNumber (1/3, 4, -1) with a decimal point 0

4, how do I get the current time, date, year, month, etc.

Time: now () Date: Date () Year: Year (Date ()) Month: Month (Date ()) Number: Day (Date ())) Hours: Hour ()) Minute: Minute (now () Second: second (now ())

5, how do I display the news title from the database from the database?

LEFT (String, Length)

Parameters String string expressions, the leftmost character is returned. LENGTH value expression indicates the number of characters to be returned. If it is 0, return zero length string (""); if it is greater than or equal to the total number of characters in the String parameter, return the entire string LEN (String | VarName)

Parameters String Any valid string expression. VarName Any valid variable name.

Suppose the news title is RS ("Topic"), we only want to output 10 characters, output all for less than 10 characters, then we write: <% if len (RS ("Topic")> 10 ThenResponse .Write left ("Topic"), 8) & "..." is not necessarily 8, how to set up how to set it, because the back is added ... so we intercept some elsereponnse.write RS ("Topic" ) end if%> Qiao achieve specific local printing house of the WEB application programmers with FileSystem components: luck (turn) date: 2001-9-16

-------------------------------------------------- ------------------------------ 1, in introduction With the rapid development of the Internet, many companies have developed Web-based business applications. system. In general, both web-based business applications use three or three-layer structures, the front desk, the client is a normal web browser, the intermediate business logic application layer is stored on the web server, and the service component on the web server is accessed. Background database. For the internet of the business system and the Internet, the web server and database system are hosted in the IDC (Internet Data Center), which requires the extraction of service data from the host on the IDC server to print output. In the case where the client browser can only print a simple HTML page, it is required to be more powerful and flexible; through the related technique to expand the browser function, you can complete more complex data printing tasks, such as Receive, payment, etc. When the author used to develop education management software for a network education company, the author uses the FileSystem component to implement the functions of the three-game payment voucher and admission tickets. 2, FileSystem Component Introduction FileSystem Components is actually an ActiveX control, which exists in the Windows platform (regardless of Win98, Win2000, or NT environment contains this component.), CLSID: 0D43FE01-11CF-8940-00A0C905428. Familiar with the ASP programming can use the FileSystem component, in general, the components are used in the server side to access and control text files, folders and drives. Object instances of FileSystem components can be created by two ways: 1. Use ASP's built-in object Server method server.createObject to create an instance of server-side objects. 2. Use the VBScript script function createObject to create an instance of the client object (or the method can be used on the server, but sometimes it will be wrong, generally not used;). FileSystem components operate on text files The following methods: CreateTextFile (filename, [overwrite if exissrs], [unicode / ascii]) // Create text file opentextFile (filename, [input / output mode], [create if not exists], [Format]) // Open text file CopyFile (filename1, filename2, [overwrite]) // Copy text file movefile (filename1, filename2) // Mobile text file deletefile (filename) // Delete text file getfile (filename) // Getting text file fileexists (filename) // Determines if the text file exists that the FileSystem component is similar to the folder and drive, and the text file is similar. In fact, the FileSystem component can also be used in the client, using the second method of creating a FileSystem component object instance, you can use this component to access and control the text files, folders and drives of the client system. Because the Microsoft platform has a FileSystem component, you don't need to download from the remote server for the client of the Microsoft platform. It will be installed and registered in installing the operating system; and the client for other platforms must install the plugin and download the FileSystem component. .

3. Implementation mechanism for local specific printing utilizes FileSystem components to implement local-specific printing procedures as shown in the figure: 1, the client sends a data request to the web server; The end browser sends back the HTML page; 3. On the client runs the script, the script acquires the data of the HTML page component, establish a connection to the printer, and outputs print data to the printer. There is no difference between the first two steps and the general web application, it is necessary to explain the third step: first use the VBScript script function createObject to create an instance of the FileSystem component object; then call the examplextExtFile method of the text file, put the print port LPT1 or The LPT2 is used as a file name parameter and sets the overwritable file parameters to True to establish a connection with the printer; the write text method of the printer text file instance is written to the printer outputs the content.

4, client-side script program example: