The Config File
As the application evolves the config file ("config_inc.asp")
tends to be the place where new features get controlled. It must be edited with
a text editor and all of the features within it are commented so you know what
they are. It is a bit randonly layed out but it is quite functional. Be sure to
explore it. I just have not had the time to clean things up or work on better
documentation just yet.
Below is what it looks like, but be sure to check out the real one as this may
be a bit outdated as I sometime forget to update this file.
<%
'*** Code below determines the names of the tables in the database
'*** Making it easy to change them should you be sharing a database and have
tables with identical names
'*** Do not edit these values unless you understand what you are doing
tbl_label_albums = "Albums"
tbl_label_cat1 = "Cat1"
tbl_label_cat2 = "Cat2"
tbl_label_cat3 = "Cat3"
tbl_label_cat4 = "Cat4"
tbl_label_config = "Config"
tbl_label_favorite_albums = "Favorite_Albums"
tbl_label_guestbook = "Guestbook"
tbl_label_messages = "Messages"
tbl_label_users = "Users"
tbl_label_postcards = "Postcards"
'*** The following code retrieves settings saved in the database
' NOTE to advanced users
' If you have a busy site and need a performace boost and want to save server
resources
' You can specify these variable values below directly here and remove the
database query to the config table
' In that scenario the web based settings page in the admin area would not be
used
' Examples..
' User_Custom1_Name = "Fax Number"
' JMAIL_Installed = True
' And so on for all fields used
' *******************************************
' Start of query to config table to retrieve settings.
Set Conn2Gallery = Server.CreateObject("ADODB.Connection")
Set CmdGetConfiguration = Server.CreateObject("ADODB.Recordset")
Conn2Gallery.Open GalleryConnectionString
SQL = "SELECT " & tbl_label_config & ".* FROM " & tbl_label_config & " Where ID
= 1"
CmdGetConfiguration.Open SQL, Conn2Gallery
Address_Required = CmdGetConfiguration("Address_Required")
Album_URL = CmdGetConfiguration("Album_URL")
CDONTS_Installed = CmdGetConfiguration("CDONTS_Installed")
City_Required = CmdGetConfiguration("City_Required")
Registration_Type = CmdGetConfiguration("Registration_Type")
User_Custom1_Name = CmdGetConfiguration("User_Custom1_Name")
User_Custom1_Required = CmdGetConfiguration("User_Custom1_Required")
User_Custom1_Used = CmdGetConfiguration("User_Custom1_Used")
User_Custom2_Name = CmdGetConfiguration("User_Custom2_Name")
User_Custom2_Required = CmdGetConfiguration("User_Custom2_Required")
User_Custom2_Used = CmdGetConfiguration("User_Custom2_Used")
User_Custom3_Name = CmdGetConfiguration("User_Custom3_Name")
User_Custom3_Required = CmdGetConfiguration("User_Custom3_Required")
User_Custom3_Used = CmdGetConfiguration("User_Custom3_Used")
User_Custom4_Name = CmdGetConfiguration("User_Custom4_Name")
User_Custom4_Required = CmdGetConfiguration("User_Custom4_Required")
User_Custom4_Used = CmdGetConfiguration("User_Custom4_Used")
User_Custom5_Name = CmdGetConfiguration("User_Custom5_Name")
User_Custom5_Required = CmdGetConfiguration("User_Custom5_Required")
User_Custom5_Used = CmdGetConfiguration("User_Custom5_Used")
User_Custom6_Name = CmdGetConfiguration("User_Custom6_Name")
User_Custom6_Required = CmdGetConfiguration("User_Custom6_Required")
User_Custom6_Used = CmdGetConfiguration("User_Custom6_Used")
Email_Required = CmdGetConfiguration("Email_Required")
EmailNotification = CmdGetConfiguration("EmailNotification")
First_Name_Required = CmdGetConfiguration("First_Name_Required")
JMAIL_Installed = CmdGetConfiguration("JMAIL_Installed")
JMAIL_ServerAddress = CmdGetConfiguration("JMAIL_ServerAddress")
AspEmail_Installed = CmdGetConfiguration("AspEmail_Installed")
AspEmail_MailHost = CmdGetConfiguration("AspEmail_MailHost")
Last_Name_Required = CmdGetConfiguration("Last_Name_Required")
Log_Off_Page = CmdGetConfiguration("Log_Off_Page")
Phone_Required = CmdGetConfiguration("Phone_Required")
PictureURL = CmdGetConfiguration("PictureURL")
ResultPageSize = CmdGetConfiguration("ResultPageSize")
SASMTPMAIL_Installed = CmdGetConfiguration("SASMTPMAIL_Installed")
SASMTPMAIL_RemoteHost = CmdGetConfiguration("SASMTPMAIL_RemoteHost")
State_Province_Required = CmdGetConfiguration("State_Province_Required")
UploadDirectory = CmdGetConfiguration("UploadDirectory")
UserCanChangeUsername = CmdGetConfiguration("UserCanChangeUsername")
UserCanChangeEmail = CmdGetConfiguration("UserCanChangeEmail")
Use_Picture_Upload = CmdGetConfiguration("Use_Picture_Upload")
Use_ASPUPLOAD_Upload = CmdGetConfiguration("Use_ASPUPLOAD_Upload")
Use_SAFILEUP_Upload = CmdGetConfiguration("Use_SAFILEUP_Upload")
Use_VBSCRIPT_Upload = CmdGetConfiguration("Use_VBSCRIPT_Upload")
Use_DUNDAS_Upload = CmdGetConfiguration("Use_DUNDAS_Upload")
VerifyURL = CmdGetConfiguration("VerifyURL")
Zipcode_Postal_Code_Required = CmdGetConfiguration("Zipcode_Postal_Code_Required")
Default_New_Album_Approval = CmdGetConfiguration("Default_New_Album_Approval")
New_Album_Send_Email = CmdGetConfiguration("New_Album_Send_Email")
New_User_Send_Email = CmdGetConfiguration("New_User_Send_Email")
Use_ASPImage =CmdGetConfiguration("Use_ASPImage")
Pic_Max_Image_Width = Cint(CmdGetConfiguration("Pic_Max_Image_Width"))
Use_AspJpeg =CmdGetConfiguration("Use_AspJpeg")
Use_ImgWriter =CmdGetConfiguration("Use_ImgWriter")
CmdGetConfiguration.Close
Set CmdGetConfiguration = Nothing
' End of query to config table to retrieve settings.
' *******************************************
'*** Variable below used in HTML Title tags
App_Name = "ASPPhotoGallery"
' Settings for navigation when viewing the album list while browsing categories
("navigation1" or "navigation2")
' "navigation1" is a list (same as Standard version uses)
' "navigation2" is 4 to a row and more graphical looking
AlbumNavigation = "navigation1"
' Settings for image navigation when viewing a album ("style1" or "style2" or
"style3")
' "style1" is the original style from the Standard version and uses javascript
to create a dynamic image viewing experience (very nice but not good when albums
have a lot of images)
' "style2" displays all the album's thumbnails.. each thumbnail then links to a
popup window where you can quickly navigate through them all.. If you are using
and Image resizing component this is really the best solution in terms of system
performance / a lot of pictures / and large picture dimensions
' "style3" lets you quickly navigate all album images and does not use
thumbnails or a popup window
ImageNavigation = "style2"
' Setting below is for the "style2" and "style3" methods above and changes where
the description is shown
' True for above False for below
ShowDescAbove = True
' Setting below is for the "style2" and "style3" methods above and turns the
rating system on or off
' The Rating system is only shown with "style1" and "style2"
' True for above False for below
UseRatingSystem = True
' Setting below is for random pictures on the main pages
' This will rotate all pictures for albums that are visible, active, and not
password protected
' This only works if you are using an image resizing component as this only
rotates true thumbnails for performance reasons
ShowRandomPics = True
' Setting below is for picture stats below the menu
' This will show the current number og uploaded pics and their total size and is
updated once per hour
ShowPicStats = True
' Setting below is for the postcard feature
' This feature only works with style2 and style3 image navigation
UsePostCards = True
'' Below are settings for the thumbnail sizes
' values "Dynamic" meaning (64w x proportional height) or "Fixed" meaning (64w x
48h)
ThumbnailSize = "Dynamic"
'ThumbnailSize = "Fixed"
' Do not change values below unless you know what you are doing
ThumbnailWidth = Cint(80)
ThumbnailHeight = Cint(60) 'only used for the fixed thumbnail option
' Below are settings for the top level category icon size
CatIconWidth = Cint(60)
CatIconHeight = Cint(60)
' Do not edit this variable unless you know what you are doing... too large a
number can seriously effect performance
' If using no image resizing component 18 is recommended
' If using an image resizing component on a shared server no more than 36 is
recommended
' If it's a very fast server a value as high as 100 should be fine though. Any
higher will require tweaks to the code.
maxpicsperalbum = 100
' Settings below controls the optional log file feature which will log any
successful logins to text files
' The directory must have proper permissions
Application("UseLogFiles") = True
' The directory below needs proper permissions set so the system can write to it
Application("LogFileDirectory") = "F:\Inetpub\wwwroot\aspphotogallery\logfiles\"
'The code belows test for windows 2003 server and changes some SQL query values
accordingly in the application pages
If Application("SERVER_SOFTWARE") = "" Then
Application("SERVER_SOFTWARE") = Request.ServerVariables("SERVER_SOFTWARE")
End If
'The code below was added in case your server supports ASP.NET and you do not
have an ASP 3.0 Image component installed on the server
'This will use ASP.NET to create dynamic thumbnail images that are small in file
size and load quickly
'This does not currently work on category icons therefore you should resize them
before uploading them
'If you enable this option be sure to select no ASP 3.0 image resizing component
in the settings area of this application
Use_ASPNET_Thumbnail = True
' The code below was added in case your email server requires smtp
authentication for sending emails and you are using the persits ASPEmail
component which supports it
UseSMTPAuth = True
SMTPUsername = "test@test.com"
SMTPPassword = "temp"
' *** Code below is used to set up the skins (Do not edit it unless you know
really what you are doing)
If Application("SkinPath") = "" And WhichDirectory <> "postcard" Then
Set fs=Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set f=fs.OpenTextFile(UploadDirectory & "\current_skin.txt", 1)
If Err.Number <> 0 Then
Err.Clear
Else
SkinName = Trim(f.ReadAll)
SkinName = Replace(SkinName,vbCrLf,"")
End If
If SkinName = "" Then
If WhichDirectory = "home" Then
SkinName = "skins/default/settings.asp"
Else
SkinName = "../skins/default/settings.asp"
End If
Else
If WhichDirectory = "home" Then
SkinName = "skins/" & SkinName & "/settings.asp?ChangeSkin=" &
Request("ChangeSkin")
Else
SkinName = "../skins/" & SkinName & "/settings.asp"
End If
End If
Response.Redirect (SkinName)
End If
%>
Disclaimer... www.CJWSoft.com makes no guarantee about the security this script offers. Use this at your own risk. To the best of knowledge it is very secure, but that doesn't mean there isn't a bug or some hacker will never find a way into it. We recommend you rigorously test it and change the password on the Access database before you start using this. That way if someone downloads your database they will a hard time getting anything useful out of it especially since the database supplied with this download is also encrypted. There are utilities available to crack Access database's so if you really want secure password protection you should port this to a SQL database. If using Access and your web is frontpage enabled you can right click on a folder in frontpage explorer and choose properties, this will allow you to uncheck "allow files to be browsed" which will stop people from downloading your Access database if they somehow figure out the URL.