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 #13071 is a reply to message #4688] Sun, 21 September 2003 12:25 Go to previous messageGo to previous message
aircool5(at)bellsouth(dot)net is currently offline  aircool5(at)bellsouth(dot)net   United States
Messages: 132
Registered: March 2003
Karma:
Senior Member
Where I have to paste this code?

heidiott wrote on Fri, 02 August 2002 18:43

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 Jul 03 06:44:37 GMT 2024

Total time taken to generate the page: 0.04307 seconds