Credit to the author.
This is what i come up with, This works on my site.
Try this :
RUN SQL :
ALTER TABLE `users` DROP `age`;
ALTER TABLE `users` ADD `birthday` date default '0000-00-00';
account-signups.php
Under :
function validusername($username) {
$allowedchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for ($i = 0; $i < strlen($username); ++$i)
if (strpos($allowedchars, $username[$i]) === false)
return false;
return true;
}
Insert this:
$year = (int)$_POST["year"];
$month = (int)$_POST["month"];
$day = (int)$_POST["day"];
if (!$year || !$month || !$day)
$message = T_("DAY_PARTY_YOU");
$birthday = "$year-$month-$day";
Comment out or delete this :
$age = (int) $_POST["age"];
In the big query :
SQL_Query_exec("INSERT INTO users (username,...
Replace :
age and
$age
with :
birhtday and
$birthday
Comment out or delete this :
<tr>
<td align="right"><?php echo T_("AGE"); ?>:</td>
<td><input type="text" size="40" name="age" maxlength="3" /></td>
</tr>
and insert this :
<tr>
<?php echo "<td class=table_col1 align=left>".T_("DATE_OF_BIRTH").": <font class=required color=#FF0000>*</font></td><td class=table_col1 align=left>";
echo "<select name='day'>n";
echo "<option value='0'>".T_("AGEDAY")."</option>n";
for ($d=1;$d<=31;$d++) {
$s = $d == $day ? 'selected' : '';
echo "<option value='$d' $s>$d</option>n";
}
echo "</select>n";
echo "<select name='month'>n";
echo "<option value='0'>".T_("AGEMONTH")."</option>n";
for ($m=1;$m<=12;$m++) {
$s = $m == $month ? 'selected' : '';
printf("<option value='$m' $s>%s</option>n",date("m", mktime(0,0,0,$m,1,1970)));
}
echo "</select>n";
echo "<select name='year'>n";
echo "<option value='0'>".T_("AGEYEAR")."</option>n";
for ($y=1909;$y<=date('Y');$y++) {
$s = $y == $year ? 'selected' : '';
echo "<option value='$y' $s>$y</option>n";
}
echo "</select></td>";?>
</tr>
Save and close.
account-signups.php
Under this :
if ($user["uploaded"] > 0 && $user["downloaded"] == 0)
$ratio = "Inf.";
elseif ($user["downloaded"] > 0)
$ratio = number_format($user["uploaded"] / $user["downloaded"], 3);
else
$ratio = "---";
Insert this :
if ($CURUSER[birthday] != "0000-00-00") {
$current = date("Y-m-d", time());
list($year2, $month2, $day2) = explode('-', $current);
$birthday = $CURUSER["birthday"];
$birthday = date("Y-m-d", strtotime($birthday));
list($year1, $month1, $day1) = explode('-', $birthday);
if ($month2 < $month1) {
$age = $year2 - $year1 - 1;
}
if ($month2 == $month1) {
if ($day2 < $day1) {
$age = $year2 - $year1 - 1;
} else {
$age = $year2 - $year1;
}
}
if ($month2 > $month1) {
$age = $year2 - $year1;
}
}
After :
<?php echo T_("AGE"); ?>: <?php echo htmlspecialchars($user["age"])?><br />
Insert this :
<?php echo T_("BIRTHDAY"); ?>: <?php echo htmlspecialchars($user["birthday"])?><br />
Save and close.
account.php
After this :
<b><?php echo T_("JOINED"); ?>:</b> <?php echo utc_to_tz($CURUSER["added"]); ?><br />
Insert this :
<?php
if ($CURUSER[birthday] != "0000-00-00") {
$current = date("Y-m-d", time());
list($year2, $month2, $day2) = explode('-', $current);
$birthday = $CURUSER["birthday"];
$birthday = date("Y-m-d", strtotime($birthday));
list($year1, $month1, $day1) = explode('-', $birthday);
if ($month2 < $month1) {
$age = $year2 - $year1 - 1;
}
if ($month2 == $month1) {
if ($day2 < $day1) {
$age = $year2 - $year1 - 1;
} else {
$age = $year2 - $year1;
}
}
if ($month2 > $month1) {
$age = $year2 - $year1;
}
}
echo"<b>".T_("AGE").":</b> ".$age." <br />";
$birthday = date("d.m.Y", strtotime($birthday));
if ($CURUSER[birthday] != "0000-00-00") {
echo"<b>".T_("BIRTHDAY").":</b> ".$birthday." <br />";
}else{
echo"<b>".T_("BIRTHDAY").":</b> <br />";
}
?>
After this :
// START CAT LIST SQL
$r = SQL_Query_exec("SELECT id,name,parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC");
if (mysql_num_rows($r) > 0)
{
$categories .= "<table><tr>n";
$i = 0;
while ($a = mysql_fetch_assoc($r))
{
$categories .= ($i && $i % 2 == 0) ? "</tr><tr>" : "";
$categories .= "<td class='bottom' style='padding-right: 5px'><input name='cat$a[id]' type="checkbox" " . (strpos($CURUSER['notifs'], "[cat$a[id]]") !== false ? " checked='checked'" : "") . " value='yes' /> " .htmlspecialchars($a["parent_cat"]).": " . htmlspecialchars($a["name"]) . "</td>n";
++$i;
}
$categories .= "</tr></table>n";
}
// END CAT LIST SQL
Insert this :
$birthday = $CURUSER["birthday"];
$birthday = date("Y-m-d", strtotime($birthday));
list($year1, $month1, $day1) = explode('-', $birthday);
if ($CURUSER[birthday] == "0000-00-00") {
$year .= "<select name='year'><option value='0000'>".T_("AGEYEAR")."</option>n";
$i = "1920";
while ($i <= (date('Y', time()) - 13)) {
$year .= "<option value='" . $i . "'>" . $i . "</option>n";
$i++;
}
$year .= "</select>n";
$birthmonths = array("01" => T_(JANUARY), "02" => T_(FEBRUARY), "03" => T_(MARCH),
"04" => T_(APRIL), "05" => T_(MAY), "06" => T_(JUNE), "07" => T_(JULY), "08" => T_(AUGUST),
"09" => T_(SEPTEMBER), "10" => T_(OCTOBER), "11" => T_(NOVEMBER), "12" => T_(DECEMBER));
$month = "<select name='month'><option value='00'>".T_("AGEMONTH")."</option>n";
foreach ($birthmonths as $month_no => $show_month) {
$month .= "<option value='$month_no'>$show_month</option>n";
}
$month .= "</select>n";
$day .= "<select name='day'><option value='00'>".T_("AGEDAY")."</option>n";
$i = 1;
while ($i <= 31) {
if ($i < 10) {
$day .= "<option value='0" . $i . "'>0" . $i . "</option>n";
} else {
$day .= "<option value='" . $i . "'>" . $i . "</option>n";
}
$i++;
}
$day .= "</select>n";
print("<tr><td align='right' class='table_col1'><b>".T_("DATE_OF_BIRTH").": </b></td><td class='table_col1'> $year . $month . $day</td></tr>");
}
if ($CURUSER[birthday] != "0000-00-00") {
print("<tr><td align='right' class='table_col1'><b>" . T_("DATE_OF_BIRTH") . ": </b></td><td class='table_col1'><input type='hidden' name='year' value='$year1' />$year1<input type='hidden' name='month' value='$month1' />.$month1<input type='hidden' name='day' value='$day1' />.$day1</b></td></tr>");
}
Comment out, or delete this :
print("<tr><td align='right' class='table_col1'><b>" . T_("AGE") . ":</b> </td><td align='left' class='table_col1'><input type='text' size='3' maxlength='2' name='age' value="" . htmlspecialchars($CURUSER["age"]) . "" /></td></tr>");
After this :
print("<tr><td align='right' class='table_col1'><b>".T_("RESET_PASSKEY").":</b> </td><td align='left' class='table_col1'><input type='checkbox' name='resetpasskey' value='1' /> <i>".T_("RESET_PASSKEY_MSG").".</i></td></tr>");
Insert this :
print( "<tr><td align='right' class='table_col1'><b>" . T_("RESET_OF_BIRTH") . ": </b></td><td class='table_col1' align='left'><input name='birthday' value='1' type='checkbox' /> <i>" . T_("RESET_BIRTH_DATE"). ".</i></td></tr>n" );
Comment out, or delete this :
$age = (int)$_POST["age"];
And this :
if (is_valid_id($age))
$updateset[] = "age = '$age'";
Before this :
$hideshoutbox = ($_POST["hideshoutbox"] == "yes") ? "yes" : "no";
Insert this :
$year = $_POST ["year"];
$month = $_POST ["month"];
$day = $_POST ["day"];
$birthday = date ( "$year.$month.$day" );
$updateset[] = "birthday = " . sqlesc($birthday);
if ((isset($_POST['birthday'])) && (($birthday = $_POST['birthday']) != ($curbirthday = $CURUSER['birthday']))) {
$newbirthday = '0000-00-00';
$modcomment = gmdate("Y-m-d") . " - BIRTHDAY " . sqlesc($user['birthday']) . " Reset to " . sqlesc($newbirthday) . " by " . $CURUSER['username'] . ".n" . $modcomment;
$updateset[] = "birthday = " . sqlesc($birthday);
}
Save and close.
Insert into
enlish.php :
//Birthday
$LANG["BIRTHDAY"] = "Birthday";
$LANG["RESET_BIRTH_DATE"] = "Reset Birth Date";
$LANG["RESET_OF_BIRTH"] = "Reset Your Date Of Birth";
$LANG["DATE_OF_BIRTH"] = "Date Of Birth";
$LANG["AGEDAY"] = "Day";
$LANG["AGEMONTH"] = "Month";
$LANG["AGEYEAR"] = "Year";
$LANG["JANUARY"] = "January";
$LANG["FEBRUARY"] = "February";
$LANG["MARCH"] = "March";
$LANG["APRIL"] = "April";
$LANG["MAY"] = "May";
$LANG["JUNE"] = "June";
$LANG["JULY"] = "July";
$LANG["AUGUST"] = "August";
$LANG["SEPTEMBER"] = "September";
$LANG["OCTOBER"] = "October";
$LANG["NOVEMBER"] = "November";
$LANG["DECEMBER"] = "December";
Save and close.
[url="
http://devscorner.xyz/applications/core/interface/file/attachment.php?id=7071"]Birthdaymode.php[/url]