2yup Drifting Prayer Bottle Everybody do it Together (c)

Source: Internet
Author: User
Tags exit end functions connect numeric value trim
"2yup Drifting Prayer bottle Everyone do Together" (iii)


'***************************************************************
(followed by the first of seven)
----------------------------------------------------------------
The following content is: 1, set up the area. 2, parameter processing. 3. Common functions.
Please put them in the first lecture (four) "Site page design" specified location, real place
The layout is in the second lecture (seven) "Site Web page production" in step 1 in the top and bottom corner.
------------------------------------------------------------------


(step 3) Establish the setting area according to (i) and the framework.

The build area is mainly based on (i) features and requirements of the 14th requirement, and now they are completed as follows:
<%
'**************************
' * * * Set AREA part * * *
'**************************

' ================= Basic setting ===============
max = 7 ' Show number per page
ListNum = 16 ' number of lists on edge
Rate = 2 ' when managing or searching bottle flow rate
user = "8chinaasp" ' admin username
PassWord = "8chinaasp" ' admin password
pagetitle= "2YUP Drifting Prayer Bottle" ' Web page name
Homepage = "2yup.com" Home page URL, do not add http://
MyWeb = "asp Chinese Net" home name
Imgtype = ". gif" ' Don't change
Picpath = "pic/" Picture Archive folder path
Path = "Pic/wishboard.mdb" Database path (please change for security)
' ================= Connection setting ===============
' Left link ' [Note: ' | | ' is a delimiter], which is the setting that produces a custom link
' Reference to Mylinks (Linkarr) in a common function can be generated.
' Description: Sort should be [link name]| | [Link Description]| | [link URL] in the middle using the separator "| |"

L1 = "Home Page | | ASP Chinese Network | | http://"&homepage&" "
L2 = "Document | | Document Center | |http://www.2yup.com/asp/article/"
L3 = "Forum | | ASP Forum | |http://www.2yup.com/asp/"
%>


<%
'****************************
' * * * Parameters Processing Part * * *
'****************************
' ================ parameter processing ================
' Get the numeric value
Keyword = Trim (Request ("K"))
Howfind = Trim (Request ("H"))
Cpage = Trim (Request ("Page")
Action = Trim (Request ("Action"))
id = Trim (Request ("id")
UserName = Session ("User")
' Manage or exit
If Action = "Exit" Then
Call Logout ()
End If
' Link Database
Call Opendb (Conn,path)
' Process login and delete
Select Case Action
' Login
Case "Login2"
Call Login2
' Delete
Case "Del"
Call Delwish ()
' Elimination ID is not an error for showing deleted bottles
id = ""
End Select

' = = = Processing Database = =
' Fetch the search data
If keyword <> "" Then
FindData = "and" &howfind& "like '%" &checkstr (keyword) & "%"
End If
' Fetch a single prayer data
If ID <> "" Then
FindData = FindData & "and id =" &id& ""
End If
' Set read and write mode
LockType = 1
If INSTR (action, "Save") or inStr (action, "detail") Then
LockType = 3
End If
' Database search
Sql= ' SELECT * Wish where pass = True ' &findData& ' ORDER by date desc '
Call Changetable (Conn,sql,rs,locktype)
' Bottle Total
num = Rs.recordcount

' = = no data processing = =
IF Rs. EOF THEN
' Set the contents of the hint when there is no data
If id = "" and keyword = "" Then
msgs = "<b> Congratulations you will be the first wishing person!" </b> "
Else
msgs = "<b> no wish bottle you are looking for!" </b> "
End If
End IF
%>


(step 4) write common functions in accordance with (iv) and framework.
In fact, this step and the next step 5--"write the various parts of the program", is not completely separate,
The obvious common functions can be used directly and written in this step, but some need to go down
A step in the combination of the preparation of the program can be correctly written. Now I'm going to let this prayer
The common functions used in the bottle program are written below, if there are errors, or unclear
to mention it.
<%
'**********************************
' * * * Universal Database Function Part * * *
'**********************************

'*******************************************************************
' Open the Database
Sub Opendb (Connect,path)
Set Connect=server. CreateObject ("Adodb.connection")
Connect.open "Provider=Microsoft.Jet.OLEDB.4.0" _
& "Data source=" &server. MapPath (PATH)
End Sub

'*******************************************************************
' Query or change the database
function changetable (conn,sql,rs,locktype)
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open Sql,conn,1,locktype
End Function

'*******************************************************************
' Close the database
Sub Closedb (Connect)
Connect.close
Set connect=nothing
End Sub

'*******************************************************************
' Close temporary table
Sub CloseTable (RS)
If rs.state = 1 Then
Rs.close
Set rs=nothing
End If



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.