Birthday Greetings On Log-in

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67486?pagenum=1
05 November 2025, 08:46

Topic


richfed
Birthday Greetings On Log-in
19 July 2008, 09:09


A while back, I noticed that on my birthday, when I visited this site, there was a "Happy Birthday" message to me up by the log-in area of the forum header.
Does anyone have the code to add this to my forum? It was pretty neat!<

 

Replies ...


Carefree
19 July 2008, 15:41


You could embed this routine wherever you want the HB to show:

Code:

	if strAgeDOB > "" then
strSql="SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE M_NAME='" & strDBNTUserName & "'"
set rsHB=my_Conn.Execute(strSql)
Member_DOB=rsHB("M_DOB")
rsHB.Close
set rsHB=Nothing
TDay=DoubleNum(Month(Date())) & DoubleNum(Day(Date()))
if mid(Member_DOB, 5, 4) = TDay then
Response.Write " <tr>" & vbNewLine & _
" <td align=""right"">Happy Birthday!</td>" & vbNewLine & _
" </tr>" & vbNewLine
end if
end if
<
RichardKinser
19 July 2008, 20:43


This is how it's implemented here:

First add the following to inc_func_common.asp:

Code:
function isbday
if strAgeDOB = "1" and MemberID > 0 then
set rsbday = my_Conn.Execute ("SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID & " AND M_DOB <> ''")

if rsbday.EOF then
isbday = "no"
else
if day(StrToDate(rsbday("M_DOB") & "000000")) = day(strForumTimeAdjust) and month(StrToDate(rsbday("M_DOB") & "000000")) = month(strForumTimeAdjust) then
isbday = "yes"
else
isbday = "no"
end if
end if
set rsbday = nothing
else
isbday = "no"
end if
end function


function getGreeting()
if isbday = "yes" then
Response.Write "Happy Birthday!"
else
Response.Write "You are logged on as"
end if
end function

Then in inc_header.asp around line #392 find:

Code:
"                <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>You are logged on as<br />"
and replace with:
Code:
"                <td align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>"
call getGreeting()
Response.Write "<br />" & vbNewLine
<
leatherlips
19 July 2008, 21:16


That's nice! I didn't know it did that. I've never input my birthday before. I just added it to my site. smile<
leatherlips
19 July 2008, 21:35


You can also add a little graphic before the birthday such as a birthday cake. I have the events calendar mod installed so I just used it.
I changed this line:
Code:
Response.Write "Happy Birthday!"
To this:
Code:
Response.Write "" & getCurrentIcon(strCalIconBDay,"Happy Birthday!","vAlign=""middle""") & " <b>Happy Birthday!</b>"
<
Carefree
19 July 2008, 21:50


Originally posted by RichardKinser
This is how it's implemented here ....

Richard, there's no call to "isbday" function that way. Since nothing else uses the functions, couldn't you combine them (as below) & call isbday instead?
Code:

function isbday
if strAgeDOB = "1" and MemberID > 0 then
set rsbday = my_Conn.Execute ("SELECT M_DOB FROM " & strMemberTablePrefix & "MEMBERS WHERE MEMBER_ID = " & MemberID & " AND M_DOB <> ''")
if rsbday.EOF then
isbday = "no"
else
if day(StrToDate(rsbday("M_DOB") & "000000")) = day(strForumTimeAdjust) and month(StrToDate(rsbday("M_DOB") & "000000")) = month(strForumTimeAdjust) then
isbday = "yes"
else
isbday = "no"
end if
end if
set rsbday = nothing
else
isbday = "no"
end if
if isbday = "yes" then
Response.Write "Happy Birthday!"
else
Response.Write "You are logged on as"
end if
end function
<
HuwR
20 July 2008, 02:44


yes you could, but if you wanted to use it in the future you would then have to re-extract the isbdy function, so I owuld leave it as 2 functions, makes no difference in terms of execution and makes it more flexible.<
Carefree
20 July 2008, 03:23


OK - then in our "inc_header.asp", we'd have to call isbday just before calling getGreeting().<
HuwR
20 July 2008, 03:36


no, but you need to change this line in callgreeting
if isbday = "yes" then

to be
if isbday() = "yes" then<
Carefree
20 July 2008, 04:05


I knew something didn't look right about that function, mind playing tricks on me again.
Tx HuwR<
richfed
20 July 2008, 08:20


Thank you, Lads!<
leatherlips
21 July 2008, 09:12


I added the code that RichardKinser posted and it is working fine. I tried to add what HuwR said in red:

if isbday() = "yes" then

but that caused it not to work any longer. I removed the () and it is working fine. Do I really need to have the ()?<
balexandre
22 July 2008, 03:29


just as a reminder...
the idea is ok, but:

on your birthday you can be "out" of the PC and the message should be something like...
for the day: "We didn't forgot about you... Happy birthday!", and then never show the message again

for the day after and until the user log in and ... not more than 2/3 weeks: "Hey, hey... we hope that you got a pleasant birth day", and then never show the message again for that year


just my opinion smile <
© 2000-2021 Snitz™ Communications