% language="vbscript"%>
<%
' DO NOT ALTER BELOW THIS LINE
' ****************************
Passwordchecker()
Sub displaypage()
Select Case request("action")
Case "addentry"
addentry
Case "editcss"
editcss
Case "editentry"
editentry
Case "deleteentry"
removeentry
Case "viewsummary"
showentries
Case "updatedetails"
updatedetails
Case "help"
showhelp
Case "smileys"
smileymanager
Case Else
welcomeform
End Select
End Sub
sub welcomeform()
topadtable
%>
Welcome to 'Blogopedia'
This Blog/News application has been designed to be very easy to use, but if you are experiencing problems - please take a visit to http://www.blogopedia.co.uk/.
To stay upto date with the latest 'Blogopedia' Version, please joing the 'Blogopedia' mailing list, by clicking here.
To get started, click on one of the admin options from below
<%
adminform
bottomadtable
End Sub
sub showentries()
topadtable
Response.write "
Summary of entries
"
Response.write "
"
Response.write "
Date
Title
Summary
Length
Filename
"
blogfile = Server.MapPath("myblogindex.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news=objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
filenames=Split(news, "**")
numrecords = Ubound(filenames)
for i = 1 to numrecords
bloginfo=split(filenames(i), "%%%")
Response.Write "
" & FormatDateTime(bloginfo(1), formdate) & "
" & bloginfo(2) & "
" & bloginfo(3) & "
" & bloginfo(4) & "
" & bloginfo(5) & "
"
Next
Response.write "
"
adminform
bottomadtable
End Sub
sub welcomeform()
topadtable
%>
Welcome to 'Blogopedia'
The 'Blogopedia' Blogging application has been designed to be very easy to use. If you are experiencing problems - please visit to http://www.blogopedia.co.uk/.
To stay upto date with the latest 'Blogopedia' Version, please joing the 'Blogopedia' mailing list, by clicking here.
To get started, click on one of the admin options from below
<%
adminform
bottomadtable
End Sub
sub showhelp()
topadtable
Response.write "
'Blogopedia' help
"
Response.write "
"
%>
Setting up the include
In order to include the blog into your page, you'll need to do one of the following:
Use an SSI include: Include the easyblog.asp file into your existing SSI compatable page (.asp files are fine for this) using code such as this: <!-- #include file="blog/easyblog.asp" -->
Use an i-frame: Include the easyblog.asp file as an iframe src like this: <iframe src="blog/easyblog.asp" width="200" height="400" name="blogopedia">
'Blogopedia' has been designed to be really easy to use - just upload the files to your webserver and it will work, but there are a few things that can go wrong:
I can't add a new entry/edit an existing entry - I get an error message This is most likely caused by you not having permissions to write data to the server. Speak to your host to ensure you have the relevent write permissions on the folder you have installed the 'Blogopedia' script into
I can't delete a new entry Again this is almost certainly due to permissions problems. Speak to your host to make sure you have delete permissions on the folder in question
I get an error on the blog summary page/summary view on my include Have you deleted the index file? 'Blogopedia' requires the file myblogindex.txt to operate - without this all your blogs are useless and the script will not execute correctly!
I want to opt not to display [insert field of your choice] on the summary/detail view on my site The look and feel of the blog is entirely controlled with CSS (cascading style sheets). You can choose not to display a particular element on the page by setting the "display" value to none for any particular style. The CSS as provided with 'Blogopedia' is fully commented to help you make changes as easily as possible.
I want to remove the copyright notices You can legally remove the copyright notices by making a donation of £5 (about $8) to dotdragnet. Click here to make a donation. You can use your credit card, or if you're in the UK you can send in a cheque or postal order. Send a copy of the confirmation email to sam@hampton-smith.com and I'll email you back a copy of the script without the copyright notices. Please note that I periodically check on sites using my scripts to make sure the copyright notices are in tact as per the licensing agreement, so if you want to use this script without it cough up - a fiver is nothing to you or me, but will help dotdragnet survive and provide it's excellent resources for some time to come.
'Blogopedia' operates without using a database making it accessible to all, but this does mean that it generates a fair few text files. Each individual blog is stored in it's own text file. The script is very easy to upgrade to make use of a database though, and once again if you email me confirmation of a donation to dotdragnet, I'll happily send you a version that uses a SQLServer or Access backend instead of text files. Note that you should not delete any of the text files generated by the script directly, but should use the delete functionality within the script itself. This way the entry in the index file will be removed as well - preventing future errors.
NOTE: this script creates files to store your blogs - do not delete any file beginning myblog... I recommed you install this script into it's own directory so you can keep all the files organised in one place.
If you are continuing to experience difficulties please do not send email to either the author, 'Blogopedia' or dotdragnet. Emails requesting support will be ignored. For personalised help, please visit the support pages at http://www.blogopedia.co.uk.
<%
Response.write "
"
adminform
bottomadtable
End Sub
Sub adminform()
%>
Admin Options
<%
displaylogout()
End sub
Sub removeentry()
topadtable
If request("idnumber")="" Then
%>
Delete an entry
<%
Else
Response.write "
Delete an entry
"
idnumber=Request("idnumber")
blogfile = Server.MapPath("myblogindex.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
userrecord=Split(news, "**")
numrecords = Ubound(userrecord)
flag=0
finalstr=""
for i = 1 to numrecords
counter=Split(userrecord(i), "%%%")
If counter(0)=idnumber Then
' Remove file from system - must have permissions set to allow this....
killfile = Server.MapPath("myblog" & counter( 0 ) & ".txt")
'killfile = Server.MapPath(counter(5))
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(killfile)
flag=1
Else
finalstr=finalstr & "**" & userrecord(i)
End If
Next
finalstr=Trim(finalstr)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine finalstr
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
If flag=1 Then
Response.Write "This entry has been deleted."
Else
Response.Write "Error: an error has occured because the entry could not be found, or the corresponding file was not present."
End If
Response.Write "
"
End If
adminform
bottomadtable
End Sub
Sub updatedetails()
topadtable
If request("password")="" Then
%>
Change Admin details
Make changes below as required to customise 'Blogopedia' to your liking.
<%
End If
adminform
bottomadtable
End Sub
Sub addentry()
topadtable
If request("title")="" Then
%>
Add an entry
Complete the details below to add your new entry.
<%
Else
blogfile = Server.MapPath("myblogindex.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
userrecord=Split(news, "**")
counter=Split(userrecord(1), "%%%")
thecount=Cint(counter(0))+1
thefile=Server.MapPath("myblog" & thecount & ".txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(thefile)
entry=blogencode(request("entry"))
title=blogencode(request("title"))
summary=blogencode(request("summary"))
objTextFile.WriteLine title & "%%%" & now() & "%%%" & summary & "%%%" & entry
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
news="**" & thecount & "%%%" & now() & "%%%" & title & "%%%" & summary & "%%%" & len(entry) & "%%%" & "myblog" & thecount & ".txt" & news
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine news
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Add an entry
Your new entry has been added
<%
End If
adminform
bottomadtable
End Sub
Sub editentry()
topadtable
If request("title")="" Then
blogfile = Server.MapPath("myblog" & request("idnumber") & ".txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
userrecord=Split(news, "%%%")
title=blogdecode(userrecord(0))
thetime=userrecord(1)
summary=blogdecode(userrecord(2))
theentry=blogdecode(userrecord(3))
%>
Edit an entry
Complete the details below to add your new entry
<%
Else
thefile=Server.MapPath("myblog" & request("idnumber") & ".txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(thefile)
entry=blogencode(request("entry"))
title=blogencode(request("title"))
summary=blogencode(request("summary"))
objTextFile.WriteLine title & "%%%" & request("thetime") & "%%%" & summary & "%%%" & entry & "%%%"
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
blogfile = Server.MapPath("myblogindex.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
userrecord=Split(news, "**")
For i=1 to ubound(userrecord)
counter=Split(userrecord(i), "%%%")
If counter(0)=request("idnumber") then
finalstr=finalstr & "**" & request("idnumber") & "%%%" & request("thetime") & "%%%" & title & "%%%" & summary & "%%%" & len(entry) & "%%%" & "myblog" & request("idnumber") & ".txt"
else
finalstr=finalstr & "**" & userrecord(i)
End If
Next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine finalstr
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Edit an entry
Your entry has been updated
<%
End If
adminform
bottomadtable
End Sub
Sub editcss()
topadtable
If request("body")="" Then
blogfile = Server.MapPath("easyblog.css")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
%>
Edit 'Blogopedia' CSS
Edit the CSS sheet below, then click save to make changes
<%
Else
thefile=Server.MapPath("easyblog.css")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(thefile)
objTextFile.WriteLine request("body")
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Edit 'Blogopedia' CSS
Your cascading style sheet has been updated
<%
End If
adminform
bottomadtable
End Sub
Sub smileymanager()
topadtable
Select Case request("method")
Case "new"
' add a record
blogfile = Server.MapPath("smileys.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
finalstr=news & "**" & request("id") & "%%%" & request("code") & "%%%" & request("url")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine finalstr
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Add a new Smiley
Your new smiley was added
<%
showsmileyedit
Case "edit"
' edit a record
blogfile = Server.MapPath("smileys.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
smileycount=Split(news, "**")
For i=1 to Ubound(smileycount)
breakout=split(smileycount(i), "%%%")
If breakout(0)=request("id") Then
finalstr=finalstr & "**" & request("id") & "%%%" & request("code") & "%%%" & request("url")
Else
finalstr=finalstr & "**" & smileycount(i)
End If
Next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine finalstr
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Edit Smiley
The selected smiley was updated.
<%
showsmileyedit
Case "delete"
' delete a record
blogfile = Server.MapPath("smileys.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
smileycount=Split(news, "**")
For i=1 to Ubound(smileycount)
breakout=split(smileycount(i), "%%%")
If breakout(0)=request("id") Then
' Do nothing - we're deleting it!
Else
finalstr=finalstr & "**" & smileycount(i)
End If
Next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(blogfile)
objTextFile.WriteLine finalstr
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Delete Smiley
The selected smiley was deleted. No further instances with that code will be converted, but any existing entries will continue to point at the image you specified
<%
showsmileyedit
Case Else
%>
'Blogopedia' Smiley Manager
Edit below, add or delete smiley code. (when you allocate the code ;) to a graphic, all instances of ";)" in your blogs will be replaced with that image)
Edit existing smileys
Code
Image
<%
showsmileyedit
End Select
adminform
bottomadtable
End Sub
Sub showsmileyedit()
blogfile = Server.MapPath("smileys.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(blogfile, 1, True)
news = objCountFile.ReadAll
objCountFile.Close
Set objCountFile = Nothing
Set objFSO = Nothing
smileycount=Split(news, "**")
For i=1 to Ubound(smileycount)
breakout=split(smileycount(i), "%%%")
counter=breakout(0)
%>
<%
Next
%>
<%
End Sub
%>