<%
Dim driverName, chs
DriverName = "Driver = {mysql odbc 3.51 driver}; server = localhost; database = discuz; uid = root; pwd = ;"
Set conn = server. createobject ("adodb. connection ")
Conn. open driverName
Set conns = Server. CreateObject ("ADODB. Connection ")
ConnStr = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & server. mappath ("news. mdb ")&""
On Error Resume Next
Conns. open ConnStr
If Err Then
Err. Clear
Set Conns = Nothing
Response. Write "An error occurred while connecting to the database ...... "
Response. End
End If
'Execute the following sentence before, which is the key to solving the problem of reading database garbled characters.
Set chs = conn. Execute ("set names 'gb2312 '")
IntId = Request. QueryString ("IntId ")
If Len (IntId) <1 Or IsNumeric (IntId) = False Then
IntId = 0
Else
IntId = CLng (IntId)
End If
Set Rs = Server. CreateObject ("Adodb. Recordset ")
'Get the currently processed data
Set Rs = Server. CreateObject ("Adodb. Recordset ")
Rs. Open "Select top 1 * From info Where id>" & IntId & "Order by id asc", conns, 1, 1
If Not Rs. Eof Then
Aid = Rs ("id ")
Title = Trim (Rs ("Title "))
Content = Trim (Rs ("Content "))
Content = Replace (Content, "& nbsp ;","")
Content = Replace (Content ,"? ","")
Content = Replace (Content, "<br>", CHR (10 ))
Content = Replace (Content, CHR (13), CHR (10 ))
Content = Replace (Content, CHR (10) & CHR (10), CHR (10 ))
Else
Response. Write "processed! "
Response. End ()
End If
Rs. Close
'The maximum pid is obtained.
Rs. Open "Select * FROM cdb_posts order by pid desc limit 1", Conn, 1, 1
NewPid = Rs ("pid") + 1
Rs. Close
'Get the maximum dateline
Rs. Open "Select * FROM cdb_threads order by dateline desc limit 1", Conn, 1, 1
NewDateline = Rs ("dateline") + 1
Rs. Close
'Insert
'Get the maximum tid
Rs. Open "Select * FROM cdb_threads order by tid desc limit 1", Conn, 1, 1
NewTid = Rs ("tid") + 1
Rs. Close
'Write to the cdb_threads table
Rs. Open "Select * FROM cdb_threads where 1 = 2", Conn, 1, 3
Rs. Addnew
Rs ("tid") = NewTid
Rs ("fid") = 10
Rs ("iconid") = 0
Rs ("typeid") = 0
Rs ("readperm") = 0
Rs ("price") = 0
Rs ("authorid") = 1
Rs ("dateline") = NewDateline
Rs ("lastpost") = NewDateline
Rs ("views") = 0
Rs ("replies") = 0
Rs ("displayorder") = 0
Rs ("highlight") = 0
Rs ("digest") = 0
Rs ("rate") = 0
Rs ("blog") = 0
Rs ("special") = 0
Rs ("attachment") = 0
Rs ("subscribed") = 0
Rs ("moderated") = 0
Rs ("closed") = 0
Rs ("itemid") = 0
Rs ("supe_pushstatus") = 0
Rs. update
Rs. Close
Sql2 = "update cdb_threads set author = 'admin', subject = '" & Title & "', lastposter = 'admin' where tid =" & NewTid
Conn.exe cute (sql2)
'----------------------------------
'Write cdb_posts
Rs. Open "Select * FROM cdb_posts where 1 = 2", Conn, 1, 3
Rs. Addnew
Rs ("pid") = NewPid
Rs ("fid") = 10
Rs ("tid") = NewTid
Rs ("first") = 1
Rs ("authorid") = 1
Rs ("dateline") = NewDateline
Rs ("invisible") = 0
Rs ("anonymous") = 0
Rs ("usesig") = 0
Rs ("htmlon") = 0
Rs ("bbcodeoff") =-1
Rs ("smileyoff") =-1
Rs ("parseurloff") = 0
Rs ("attachment") = 0
Rs ("rate") = 0
Rs ("ratetimes") = 0
Rs ("status") = 0
Rs. update
Rs. Close
Set Rs = Nothing
Sql2 = "update cdb_posts set author = 'admin', subject = '" & Title & "', message = '" & Content & "', useip = '2017. 0.0.1 'where pid = "& NewPid
Conn.exe cute (sql2)
Response. write "<br> <div align = center> <B>" & IntId & "</B> data records have been transferred, the data number is <B> "& aid &" </B>! </Div>"
Response. Write "<script> location. href (""? IntId = "& IntId + 1 &" "); </script>"
%>