Classic ASP Active Server Pages Examples, code, tutorials, scriptsUse Free Zip Component With This Script To Backup Your Site in Case You Need to Restore it.

This site archiving and backup script uses the free Zip Component from

Required: free zip component from http://www.xstandard.com/page.asp?p=C9891D8A-5390-44ED-BC60-2267ED6763A7 to create zip files of your site that are named by the date and time at which they are created. This is a quick and easy way to back up your sites.

Please understand, I offer no guarantees or promises, so use at your own risk after testing in a safe environment. All I know is, it works OK for me.

I searched for and found the Xstandard.com zip component after one of my clients managed to delete her entire site w/o having first kept a backup copy. AAAAARRRGH!!!!!! Then I experimented a bit with the Xstandard sample code and wrote this little quickie script. No bells and whistles but gets the job done for me; copied a site into a 65 mb zip file within a couple of minutes or less.

If your host doesn't offer the Xstandard.com zip component, ask Support to install it for you.

Change the URLS and paths in red below to your own. The folder you select to receive your backup files will need to be made writeable.

<%

'default.asp
'script part 1 of 2 by Lil Peck, equineexpo.com/aspexamples
'Required: free zip component from http://www.xstandard.com/page.asp?p=C9891D8A-5390-44ED-BC60-2267ED6763A7

%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Backup Site</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body style="font-family: Verdana; font-size: 10pt">
<%
dim userid, password
userid = "admin" 'change this to what you want
password = "password" 'be sure to change password to your own choice
%>
<form method="POST" action="default.asp">

<p><input type="text" name="T1" size="20"> User ID</p>
<p><input type="text" name="T2" size="20">Password</p>
<input type="hidden" name="T3" size="20" value="validate">
<p><input type="submit" value="Submit" name="B1"></p>
</form>
<%
If request.form("T1") = userid then
If request.form("T2")= password then
session("archiver") = userid
Session.Timeout=60
end if
end if
if session("archiver")<>"" then
response.redirect"archive.asp"
end if
%>
</body>

</html>
 

 

<%

'archive.asp
'script part 2 of 2 by Lil Peck, equineexpo.com/aspexamples
'Required: free zip component from http://www.xstandard.com/page.asp?p=C9891D8A-5390-44ED-BC60-2267ED6763A7

%>

<%
if session("archiver")="" then
response.redirect"default.asp"
end if
Session.Timeout=60
%>
<% Server.ScriptTimeout = 3600 %>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Backup Site</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body style="font-family: Verdana; font-size: 10pt">
<b>
<% If request.form("C1") = "" then %>This script will create a zip file archive of this folder:
<a target="_blank" href="http://yoursiteURL/home">http://yoursiteURL/home</a>
. </b>
<p><b>Click the button below <font color="#FF0000">ONCE</font> and
<font color="#008000">WAIT</font>.</b> Large folders with many large files take
longer to zip. </p>
<p>Your zip folder will be named for the date and time at which it
is created, so no zip file will be overwritten by a previously created one. The
backup zip files are stored beneath the public_html folder so that casual site
visitors cannot download those files.</p>
<p><b>You
may download your zip files from this folder:
</b>D:\yourPath\backups. </p>
<p>It is suggested that you make a
practice of downloading current archives on a regular basis in addition to using
this script at least weekly or after each significant update of the site.</p>
<p><i>Are
you ready to create a new site archive/backup file?</i></p>
<form method="POST" action="archive.asp">

<p><input type="checkbox" name="C1" value="ON"><input type="submit" value="Zip It!" name="B1"></p>
</form>
<p><br>
&nbsp;</p>
<p>&nbsp;</p>
<% end if %>
<% If request.form("C1") = "ON" then %>
<br>
<%
Dim objZip
Set objZip = Server.CreateObject("XStandard.Zip")
objZip.Pack "D:\yourPath\public_html\home\", "D:\yourPath\backups\"& "M" & Month(now())&"_"& "D" & Day(now())&"_"&"Y" & Year(now())&"_"& "m" & Minute(now())&"_"&"S" & Second(now())& ".zip"

response.write" Your zipped web archive file is now ready to download from this folder: D:\yourPath\backups"
Set objZip = Nothing

%><p><a href="archive.asp">RETURN TO SITE ARCHIVING FORM</a></p>
<% end if
%>
</body>

</html>

 


ASP Examples Menu of Active Server Pages scripts code Classic ASP

Classic ASP Active Server Pages Examples, code, tutorials, scriptsASP Examples Menu (below*)



Active Server Pages | ASP | Scripts | Tutorials | Code | Web Programming | Examples
Active Server Pages ASP code examples, tutorials, and snippets for use in Programming interactive websites.

NOTE: Recently changed hosting and url so some demos aren't working now because I haven't updated pathing; if you find omissions or errors let me know.
 

*

Multiple records per row with paging

Display multiple records per row

Get ID of newly inserted record, Classic ASP, Access Database

Javascript timer with ASP to keep track of time expired until login expires / timeout session is up

Multiple Javascript event functions triggered from single form onsubmit

Get Querystring key names along with querystring variables

ASP Youtube Downloader  Version FOUR
All ASP code. Allows user client side downloads of Youtube videos. You have the option to allow files to be saved directly to your site also.

ASP/PHP video downloader (Works better than ASP for large files)

Use ASP to dynamically parse a Youtube XML playlist to render to html.

Zip up an archive file of your site for backup if you need to restore website with ASP and free Zip Component.

Zip all files in a folder into an archive or backup file dynamically by specific file extension.

Sanitize or clean price cost field for database insertion or display.

Javascript image dimensions and image file size preview.

Put recordset into array, assign keys to the records then use record associated with specific array key as a variable elsewhere.

Access Database Interface Generator Wizard to read your table and field names and to create a table display.

Combining dropdown selection box menu with dynamic ASP database page.

How to redirect user to original page they tried to view before logging, after they are logged in.

Previous/Current/Next Records, or Buddy Ring Script

Custom ASP 404 page not found error script sends visitors to virtual folders

ASP Example: Combine ASP with Javascript for popup windows
dynamically sized to image dimensions.

ASP Example: How to use ASPJPEG to create thumbnails
Click for free Highly recommended thumbnailer for which you don't need Server access

ASPjpeg: How to re-scale aspect ratio of thumbnails by height instead of width.

ASP Example: What if your host has an older version of ASPJPEG that doesn't support gifs?

Using inline frames as "dynamic includes" (offline for updating)

Select Count Distinct Records for Access Database

Upload Image to folder and insert filename into database

Get date in such a way that it can be made part of a file name

Isolate a file name away from its path or extension or strip a path from a file name or strip characters from database field

User-customized on-the-fly stylesheet css files

Enhanced Page Hits Counter (also counts downloads and menu link hits)

Loop through array and compare to string with select case

Aphabetical Paging for your ASP scripts

Web Wiz Guide's Site Searcher Script modified as a file content indexer

Let Users Select How Many Records to View

Access Database for your PayPal IPN scripts

Miscellaneous collected code

You don't have to be a genius, just persistent, to write original Active Server Pages scripts

Software Recommendation: bare_bones_no_bells_and_whistles_asp_code_generator_database_interface_maker

--Lil at gmail.com