Execute an ASP file to prevent Access database downloads

Source: Internet
Author: User
Tags relative table name access database
access| Data | database | download | The implementation of the idea is from: <% use, and then the ASP to execute the error.

Now just write him as an ASP code, easy to use.

Because such words can be directly executed on the OK, do not have to download the database and then build the table and so on .... And then upload the overlay ...

My code is just to achieve this function: be practical. Please give me a lot of advice ....

By the way, add the background of this code: I also proposed that the MDB mapping is better, also made a video, and then he hard to ask: do not do insinuate of the virtual host how to do, so hastily wrote such a piece of code to avoid his download and then manually insert <% and then upload the trouble.

1. Added a detailed description of the error.

2. I should be able to solve this problem with a random table.

3. I add a number of <% can also basically avoid the problem of%> it. I think this is a good idea when there are no binary data involved in the simple other places.

At the same time thank Zhouzhen for his criticism. Welcome to criticize again. Thank you

<%option explicit%>
<%
Dim Str_form,str_version,i
Dim Mdbfile,conn,rec,str_notdown,tabale_notdown
Str_version= "Code by like sad qq:122545971<br>"
str_version=str_version& "page code function: Prevent Access database from being downloaded <br>" & "feature is: easy to use, upload directly to the space execution is complete. <br> "
str_version=str_version& "Powers Alliance family <a href= ' http://www.powers.com.cn ' >_blank>http:// Www.powers.com.cn</a><br> "


Mdbfile=request ("Mdbfile")

If mdbfile= "" Then
str_form= "<form action= ' method= ' post ' > database file name [contains relative path]:<input type=text <input type= ' submit ' name= ' submit ' value= ' prevent download ' > '
Call Out_ys (Str_form)
Response.End
End If


Mdbfile=server.mappath (Mdbfile)
Set Conn=server.createobject ("Adodb.connection")
On Error Resume Next
Conn.Open "Driver={microsoft Access Driver (*.mdb)};uid=admin;pwd=;d bq=" &mdbfile
If ERR Then
Err. Clear
Set Conn = Nothing
Call Out_ys ("Database connection error, check database name and relative path is correct <a href= ' javascript:history.back () ' > Return </A>")
Response.End
End If


On Error Resume Next
' Take a random table name
RANDOMIZE ()
Tabale_notdown= "Notdown" &int (9999*rnd () +1)
Tabale_notdown= "notdown678"
Conn.execute ("CREATE TABLE" &tabale_notdown& "(Notdown image)")
If Err Then
Call Out_ys ("Error:<b>" &err.) Description & "</b>,<br><br> please follow the prompts to solve this problem")
Else
STR_NOTDOWN=CHRB (&AMP;CHRB) (37)
For I=1 to 13
STR_NOTDOWN=STR_NOTDOWN&AMP;CHRB (&AMP;CHRB) (37)
Next
Set Rec=server.createobject ("Adodb.recordset")
Rec. Open "SELECT * from Notdown", conn,1,3
Rec.addnew
Rec ("Notdown"). AppendChunk Str_notdown
Rec.update
Rec.close
Set rec=nothing
Call Out_ys ("Prevent download complete, and remind if you are not ASP extension, please modify to ASP")
End If
Conn.close
Set conn=nothing
Sub Out_ys (str_out)
Response.Write "<div align=left>" &str_version& "</div><center>" & "<br><br &GT;&LT;BR ><br> "&str_out&" <br> "&" <br> "&" <br> "&" <br> "& "<br>" & "&l t;br></center>"
End Sub
%>



Related Article

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.