")
else
RESPONSE.WRITE("
")
end if
call drawComment(rs.Fields("comment_id").value)
RESPONSE.WRITE("
")
count = count + 1
rs.MoveNext
loop
RESPONSE.WRITE("
View all site comments")
rs.close
end sub
' 2007.01.07 draw a comment given a comment id.
sub drawComment(comment_id)
rsp.Open "Select * FROM COMMENTS where comment_id = " & comment_id , conn
RESPONSE.WRITE("
On " & createDateString(rsp.Fields("date_created").value))
RESPONSE.WRITE(" " & rsp.Fields("user_name").value & " wrote:")
RESPONSE.WRITE("
" & rsp.Fields("body").value)
if rsp.Fields("deleted").value = "1" then
RESPONSE.WRITE("
COMMENT DELETED BY ADMIN")
end if
' Draw button to allow admin user to delete this post.
if canCreateModPost() = 1 then
dim back_url
back_url = curPageURLWithVariables()
%>
<%
end if
if canCreateModPost() = 1 then
dim delPostUrl
delPostUrl = "action.asp?action=delete_comment&object_id=" & comment_id
RESPONSE.WRITE("
DELETE POST")
end if
'RESPONSE.WRITE("
?" & rsp.Fields("comment_id").value)
'RESPONSE.WRITE("
?" & rsp.Fields("post_id").value)
'RESPONSE.WRITE("
?" & rsp.Fields("user_id").value)
'RESPONSE.WRITE("
?" & rsp.Fields("user_name").value)
'RESPONSE.WRITE("
?" & rsp.Fields("body").value)
'RESPONSE.WRITE("
?" & createDateString(rsp.Fields("date_created").value))
'RESPONSE.WRITE("
?" & rsp.Fields("deleted").value)
rsp.close
end sub
' 2007.01.07 Draw form used for submitting comments.
' if the global variable g_enableComments is false then it displays
' a message instead.
sub drawCommentPostingForm(post_id, parent_type)
dim back_url
back_url = curPageURLWithVariables()
if g_enableComments <> true then
RESPONSE.WRITE("
Comment posting is currently disabled.")
else
RESPONSE.WRITE("
Post a comment:")
%>
<%
end if
end sub
sub updateTagCountForAllTags
dim sql
sql = "Select distinct tag_string FROM TAGS"
sql = sql & " where deleted <> '1' and object_type='IMAGE'"
rs.Open sql, conn
if rs.EOF then
RESPONSE.WRITE("
updateTagCountForAllTags: No tags found.")
rs.close
exit sub
end if
do until rs.EOF
call updateTagCount(rs.Fields("tag_string").value, "IMAGE")
rs.MoveNext
loop
rs.close
end sub
sub updateTagCount(tag_string, object_type)
dim sql
sql = "SELECT count(tag_string) as tag_count FROM TAGS where tag_string='" & tag_string & "'"
sql = sql & " and object_type='" & object_type & "'"
'RESPONSE.WRITE("
sql: " & sql)
rsp.Open sql, conn
if rsp.eof then
'RESPONSE.WRITE("
no Tags found for string:" & tag_string)
rsp.close
exit sub
end if
dim num_rows
num_rows = rsp.Fields("tag_count").value
'RESPONSE.WRITE("
tag_count = " & rsp.Fields("tag_count").value & " for: " & tag_string)
rsp.close
' Now determine if a row exists in TAG_COUNT for the tag.
sql = "select 1 from TAG_COUNT where tag_string='" & tag_string & "'"
sql = sql & " and object_type='" & object_type & "'"
rsp.Open sql, conn
dim row_exists
if rsp.eof then
RESPONSE.WRITE("
No TAG_COUNT row found for string:" & tag_string)
row_exists = 0
else
RESPONSE.WRITE("
TAG_COUNT row found for string:" & tag_string)
row_exists = 1
end if
rsp.close
' Update or insert tag count row.
if row_exists = 0 then
sql = "insert into TAG_COUNT (tag_string, object_type, tag_count)"
sql = sql & " values ('" & tag_string & "','" & object_type & "'," & num_rows & ")"
RESPONSE.WRITE("
SQL: " & sql)
conn.Execute sql
end if
if row_exists = 1 then
sql = "update TAG_COUNT set tag_count=" & num_rows
sql = sql & " where tag_string='" & tag_string & "' and object_type='" & object_type & "'"
RESPONSE.WRITE("
SQL: " & sql)
conn.Execute sql
end if
'insert into TAG_COUNT (tag_string, object_type, count) values ( 'imogen','IMAGE', 22)
end sub
%>
<%
' Connect to database.
'set conn=Server.CreateObject("ADODB.Connection")
'conn.Provider="Microsoft.Jet.OLEDB.4.0"
'conn.Open(Server.Mappath("..\private\maindb.mdb"))
' Connect to database.
call databaseConnect(SERVER)
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "Select max(user_id)+1 FROM USERS", conn
dim next_user_id
next_user_id = rs.Fields(0).value
dim apply
rs.Close
apply = int(Request.QueryString("apply"))
'Response.Write("apply is " & apply)
' Added 02.09.2006
dim ipAddress
ipAddress = Request.ServerVariables("REMOTE_ADDR")
'Response.Write("
Address:" & ipAddress)
dim bannedIdDetected
if ipAddress = "24.51.237.200" then bannedIdDetected = 1 ' Hotbox spammer
if ipAddress = "172.149.18.213" then bannedIdDetected = 1 ' Hotbox spammer
if ipAddress = "195.225.177.137" then bannedIdDetected = 1 ' Yahoo spammer
if ipAddress = "95.141.35.231" then bannedIdDetected = 1 ' ' NJD - 2010.02.19
if ipAddress = "91.201.66.76" then bannedIdDetected = 1 ' ' NJD - 2010.02.19
%>
<%
if apply <> 1 then
if bannedIdDetected <> 1 then
%>
<%
else ' banned IP address detected
Response.Write("
Adr" )
end if
else
dim bannedStringFound
dim emptyStringRecieved
dim password
dim email
dim username
dim user_level
dim userAvailable
randomize ' randomize the generator.
' Generate random initial password.
password = Int(1234 + (Rnd(1) * 7000) )
user_id = next_user_id
username = Request.Form("username_b")
email = Request.Form("email_b")
' Check for banned strings in email
' Added 31.08.2006 - NJD
if InStr(email,"hotbox") <> 0 then bannedStringFound = 1
if InStr(email,"email@gmail.com") <> 0 then bannedStringFound = 1
' Check for a field being blank, in which case we display nothing -
' to prevent annoying spam emails.
if email = "" or username = "" then emptyStringRecieved = 1
' Set default initial user data.
user_level = 1
date_created = date()
notes = "no description"
' Detect if a user with the same name exists in the DB
rs.Open "Select * FROM USERS WHERE user_name = '" & username & "'", conn
if rs.EOF then userAvailable = 1
if emptyStringRecieved = 1 then
' do nothing
elseif userAvailable and bannedStringFound = 0 then
' No records found - username is unique
' Create the user
sql = "INSERT INTO USERS "
sql = sql & "VALUES (" & user_id & ",'" & username & "','" & password & "'," & user_level & ","
sql = sql & "'" & date_created & "', 'no details', '0','" & email & "' )"
' Debug output - security risk, dont display
if 1=2 then
Response.Write ("sql statement: " & sql)
end if
%>
<%
on error resume next
conn.Execute sql,recaffected
dim send_mail
send_mail=1
' Debug output - security risk, dont display
if 1=2 then ' used to switch on debug output
' Debug version
if err<>0 then
Response.Write("
ERROR" & err.description)
send_mail = 0
else
Response.Write("" & recaffected & " record edited
")
end if
else
if err<>0 then
Response.Write("DATABASE ERROR
")
send_mail = 0
else
Response.Write("user added...
")
end if
end if
conn.close
if send_mail = 1 then
' Send the mail
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Coolbubble - sign up info."
myMail.From="signup@coolbubble.com"
myMail.To=email
myMail.TextBody ="Thank you for signing up to coolbubble.com" & vbCrLf
myMail.TextBody = myMail.TextBody + "Username: " & username & vbCrLf
myMail.TextBody = myMail.TextBody + "Password: " & password & vbCrLf & vbCrLf
myMail.TextBody = myMail.TextBody + "Please sign in to change your password." & vbCrLf
myMail.TextBody = myMail.TextBody + "~ Nick" & vbCrLf
myMail.Send
set myMail=nothing
' Send the mail to admin
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Coolbubble - sign up info."
myMail.From="signup@coolbubble.com"
myMail.To="nick@coolbubble.com"
myMail.TextBody ="Someone has signed up to coolbubble.com" & vbCrLf
myMail.TextBody = myMail.TextBody + "Username: " & username & vbCrLf
myMail.TextBody = myMail.TextBody + "email: " & email & vbCrLf
myMail.TextBody = myMail.TextBody + "ip address: " & ipAddress & vbCrLf
myMail.TextBody = myMail.TextBody + "~ Nick" & vbCrLf
myMail.Send
set myMail=nothing
' Display message
Response.Write("An email has been sent to " & email & " thanks!" )
end if
else
' Username is not unique - display an error message.
Response.Write("This user name already exists, please try another name.")
' Send the mail to admin on fail
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Coolbubble - REJECTED sign up info."
myMail.From="signup@coolbubble.com"
myMail.To="nick@coolbubble.com"
myMail.TextBody ="Someone TRIED to signed up to coolbubble.com" & vbCrLf
myMail.TextBody = myMail.TextBody + "Username: " & username & vbCrLf
myMail.TextBody = myMail.TextBody + "email: " & email & vbCrLf
myMail.TextBody = myMail.TextBody + "ip address: " & ipAddress & vbCrLf
myMail.TextBody = myMail.TextBody + "~ Nick .. HAH!" & vbCrLf
' NJD 2011.03.11 - stopped sending these mails to me as it was annoying
' myMail.Send
set myMail=nothing
end if
rs.close
end if
%>