FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Birthday hack
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Birthday hack [message #4688 is a reply to message #4352] Fri, 02 August 2002 22:43 Go to previous messageGo to previous message
heidiott is currently offline  heidiott   United States
Messages: 34
Registered: May 2002
Karma:
Member
I did it Cool
Here is the function...


<?php
function bday()
{
include_once "path/to/GLOBALS.php";

$cid = mysql_connect($DBHOST, $DBHOST_USER, $DBHOST_PASSWORD);
mysql_select_db($DBHOST_DBNAME, $cid);
$time = date(m);
$cur_year = date(Y);
$quary ="SELECT id, login, bday FROM fud_users WHERE bday>0";

$result = mysql_query($quary);
//print "This months birthdays...<br>");
while(list($id, $login, $bday) = mysql_fetch_row($result))

{
$month = substr($bday, -4, 2);
$year = substr ($bday, -0, 4);
$age = $cur_year - $year;

if ($month == $time)
{

print ("<a href=\"http://forum_url/index.php?t=usrinfo&id=$id\">$login</a> <span class=\"small\">(<b>$age</b>)</span><br&g t;\n");
}
}
}

?>

Call the function with...

<?php bday(); ?>

I decided to show all birthdays for the current month instead of each day. The code could easily be changed to show birthdays by day.

Have fun!
Heidi
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Default font size changes
Next Topic: chinese search
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 00:02:40 GMT 2024

Total time taken to generate the page: 0.03874 seconds