dim conn,dbs //定義變量 Set conn=Server.CreateObject("ADODB.Connection") //建立連接對象 dbs=server.mappath("url.mdb") //定義要連接的數(shù)據(jù)庫路徑 conn.open "driver={microsoft access driver (*.mdb)};dbq="&dbs //打開并實(shí)現(xiàn)其數(shù)據(jù)庫源的鏈接 user=trim(request.querystring("user")) //得到default.html文件中得到的在瀏覽器中輸入的網(wǎng)址 if user<>"" then //當(dāng)user值不為空時 user=replace(user,"http://","") //將"http://"字符串從user值刪去 at=instr(user,"@") //將user值中"@"所在位置賦給變量at else response.write "信息出錯,請聯(lián)系moon!" //當(dāng)user值為空時則告訴網(wǎng)友有錯 end if if at>0 then user=left(user,at-1) //當(dāng)user值中"@"所在的位置大于0時,將其中的部分重賦給user,如"BBS"或" GUESTBOOK"等值 else response.redirect "def.htm" //如果沒有得到其中的值,如打http://www.luyu.net時,就返回def.htm文件中。 response.end //停止輸出 end if if user<>"" then set rs=conn.execute("select url from dns where user='"&user&"'") //當(dāng)user值不為空時,連接數(shù)據(jù)庫,將進(jìn)行搜索 if not rs.eof then conn.execute("update url set click=click+! Where user='"&user&"'")//當(dāng)記錄不為空時,將此網(wǎng)站的訪問量加1 response.redirect rs("url") //再轉(zhuǎn)向其網(wǎng)站 else response.write "抱歉,沒有這個網(wǎng)站!" //記錄為空時,警告網(wǎng)友沒有此網(wǎng)站 end if set rs=nothing else response.write"抱歉,沒有這個域名!" //當(dāng)user的值為空時,則警告網(wǎng)友沒有此域名 end if set conn=nothing //關(guān)閉數(shù)據(jù)庫連接