NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is ten + seven?

Go back

Topic review (newest first)

Trunksi
04-01-2010 08:27:22

it's working again smile
thanks alot for that really fast help big_smile

Waccoon
04-01-2010 05:47:16

Trunksi wrote:

is this code still working?

No, the database code has changed.  Here's an updated version (with a few fixes):

Code:

<?php
//===========================================================================
// BIRTHDAYS START
//===========================================================================

$birthday_names = array();
$todaymonth = date ("m");
$todayday = date ("d");

$my_result = db_query ("SELECT usrname, age FROM {$OekakiPoteto_MemberPrefix}oekaki ORDER BY usrname");

if ($my_result && db_num_rows($my_result) > 0) {
    while ($my_row = db_fetch_array($my_result)) {
        $my_age = $my_row['age'];
        if (strpos($my_age, '-') !== FALSE && strpos($my_age, '?') === FALSE) {
            list ($byear, $bmonth, $bday) = explode ('-', $my_age);

            $my_bday_pass = FALSE;
            if ($todaymonth == '2' && $todayday == '29') {
                // Leap year birthday?
                if ($bmonth == $todaymonth) {
                    if ($bday == '28' || $bday == '29') {
                        $my_bday_pass = TRUE;
                    }
                }
            } elseif (($bday == $todayday) && ($bmonth == $todaymonth)) {
                $my_bday_pass = TRUE;
            }
            
            if ($my_bday_pass == TRUE) {
                $un = trim($my_row['usrname']);
                $un_url = urlencode($un);
                $un_html = w_html_chars($un);
                $un_years = get_age($my_age);

                $birthday_names[] = "<a href=\"profile.php?user={$un_url}\">{$un_html} ({$un_years})</a>";
            }
        }
    }
}

if (count ($birthday_names) > 0) {
    echo ('<p>');
    echo ("Birthday greetings to: " . make_list($birthday_names, ', '));
    echo ('</p>');
}

//===========================================================================
// BIRTHDAYS END
//===========================================================================
?>
Trunksi
03-31-2010 06:12:53

is this code still working?
today it's a members birthday but it doesn't show up
so I thought since the new changes because of some code stuff (PHP6 and such)
it might be not working correctly anymore and that's why it doesn't shows up

acwitness
01-17-2008 07:34:04

Is there some code I could add in this to make it play a midi file once through?

Nullig
07-16-2006 11:29:33

I just noticed in the following line in your script that the \" between user= and {$un_url} was screwing up the link to the user profile. I took it out, and all is well.

$birthday_names[] = "<a href=\"profile.php?user=\"{$un_url}\">{$un} ({$age_years})</a>";

Nullig

Nullig
06-24-2006 21:42:27

Super. I'll give it a try.

Thanks,

Nullig

Waccoon
06-24-2006 16:25:24

Hey, cool.

Couple things, though...  you don't need to make a connection to the database if this is included in the notice.  I also have a function called "make_list()" which makes it easier to show lists of names with arrays.  Try out this version.  It can be pasted directly into the notice, or saved as birthday.php and use "<? include ('birthday.php') ?>" in the notice.

Code:

<?php

$birthday_names = array();
$todaymonth = date ("m");
$todayday = date ("d");

$my_result = mysql_query ("SELECT usrname, age FROM {$OekakiPoteto_MemberPrefix}oekaki ORDER BY usrname");

if (mysql_num_rows ($my_result) > 0) {
    while ($my_row = mysql_fetch_array ($my_result)) {
        $age = $my_row['age'];
        $birthday = substr ($age, -2);
        $birthmonth = substr ($age, -5, 2);

        if (($birthday == $todayday) && ($birthmonth == $todaymonth)) {
            $un = trim ($my_row['usrname']);
            $un_url = urlencode ($un);
            $age_years = get_age($age);

            $birthday_names[] = "<a href=\"profile.php?user=\"{$un_url}\">{$un} ({$age_years})</a>";
        }
    }
}

if (count ($birthday_names)) {
    echo ('<span style="color:red;">');
    echo ("Birthday greets to: " . make_list($birthday_names, ', '));
    echo ('</span><br /><br />');
}

?>
Nullig
06-23-2006 12:47:09

Added birthday greetings to my site. Here's the code if anyone wants it.

In the banners I added this in the notice area: <? include ("birthdays.php"); ?>

Here is the birthdays.php code:

<?php

$my_host = "localhost"; //Hostname
$my_user = "yourusername"; //Database Username
$my_pass = "yourpassword"; //Database password
$my_data =  "yourdatabasename"; //Database name

$my_table = "op_oekaki"; //Table name

$message = "";
$finalmessage = "";

$todaymonth = date("m");
$todayday = date("d");


$my_dbconn = mysql_connect("$my_host", "$my_user", "$my_pass") or die("Could not connect: " . mysql_error());
mysql_select_db("$my_data",$my_dbconn);

$my_result = mysql_query("SELECT * FROM $my_table ORDER BY usrname",$my_dbconn);

if ($my_row = mysql_fetch_array($my_result)) {

  do {

    $username = trim($my_row['usrname']);
    $age = $my_row['age'];
    $birthday = substr($age, -2);
    $birthmonth = substr($age, -5, 2);

    if (($birthday == $todayday) && ($birthmonth == $todaymonth)) {

      $message = $message . $username . "&nbsp;&nbsp;";

    }


  } while ($my_row = mysql_fetch_array($my_result));

}


if ($message <> "") {

  $finalmessage = "<span style=\"color:red;\">Birthday greets to:&nbsp;" . $message . "</span><br />&nbsp;<br />";
  echo $finalmessage;

}

?>

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB