Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Date of Birth addon for 2.08
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2014-05-22 10:45:19
this is based on [url="http://torrenttrader.org/index.php?showtopic=4591&hl=birthday"]http://torrenttrader.org/index.php?showtopic=4591&hl=birthday[/url]

and [url="http://torrenttrader.org/topic/11611-date-of-birth-at-registration"]http://torrenttrader.org/topic/11611-date-of-birth-at-registration[/url]

I did not create it, I just fixed it to work with 2.08

If you dont know what this does then prob not for you.

1st sql

ALTER TABLE `users` ADD dob DATE NOT NULL default '0000-00-00';
Then languages.find

$LANG["AGE"] = "Age";
after add

$LANG["DATE_OF_BIRTHDAY"] = "Birth Date";
$LANG["DOB_FAILED_MSG"] = "Do not leave any required Birthday Fields blank.";

account.phpchange

<b><?php echo T_("AGE"); ?>:</b> <?php echo $CURUSER["age"]; ?><br />to

<?php
///////////////// BIRTHDAY MOD /////////////////////
if ($CURUSER[dob] != "0000-00-00") {
   $current = gmdate("Y-m-d", time() + $CURUSER['tzoffset'] * 60);
   $birthday = $CURUSER["dob"];
   list($year2, $month2, $day2) = preg_split('/[-]/', $current);
   list($year1, $month1, $day1) = preg_split('/[-]/', $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;
   }
   print(T_("AGE").": $agen");
   print(T_("DATE_OF_BIRTHDAY").": $birthdayn<br />");
}
///////////////// BIRTHDAY MOD /////////////////////
?>        

remove

 if (is_valid_id($age))
$updateset[] = "age = '$age'";

account-details.phpreplace

<?php echo T_("AGE"); ?>: <?php echo htmlspecialchars($user["age"])?><br />with
<?php
if ($user[dob] != "0000-00-00") {
   $current = gmdate("Y-m-d", time() + $CURUSER['tzoffset'] * 60);
   $birthday = $user["dob"];
   list($year2, $month2, $day2) = preg_split('/[-]/', $current);
   list($year1, $month1, $day1) = preg_split('/[-]/', $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;
   }
   print(T_("AGE").": $agen");
   if ($user["id"] == $CURUSER["id"] || $CURUSER["control_panel"] == "yes") {
       print(T_("DATE_OF_BIRTHDAY").": $birthdayn<br />");
   } else {
       print("n<br />");
   }
}
///////////////// BIRTHDAY MOD /////////////////////
?>        

account-signup.phpreplace


$age = (int) $_POST["age"];

with
    $year = (int) $_POST["year"];
   $month = (int) $_POST["month"];
   $day = (int) $_POST["day"];
   if (!$year || !$month || !$day)
       $message = T_("DOB_FAILED_MSG");
   $dob = "$year-$month-$day";

farther down replace
, age

with
, dob

and
, $age

with
, $dob
Unknown User
2014-05-22 12:53:59
yes off course ArticWolf  B)

thank you for topic

I'm not glassis  :lol:
Unknown User
2014-06-08 18:19:42
Hmm,  I have followed direction to a T... yet during signup there is still just a place to imput your age. Also, all my exsisting users now have ablank spot where ther age use to be... :-/ Thanks tho.
2014-07-31 13:24:51
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' />&nbsp;" .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' />&nbsp;<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' />&nbsp;<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]
Birthdaymode.php
Download
2014-08-01 08:19:42
A small update :

In account-details.php :

Comment out, or delete this :

<?php echo T_("AGE"); ?>: <?php echo htmlspecialchars($user["age"])?><br />

Beneath :

<?php echo T_("COUNTRY"); ?>: <?php echo $country?><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"".T_("AGE").": ".$age." <br />";
$birthday = date("d.m.Y", strtotime($birthday));
if ($CURUSER[birthday] != "0000-00-00") {
echo"".T_("BIRTHDAY").": ".$birthday." <br />";
}else{
echo"".T_("BIRTHDAY").": NONE ADDED<br />";
}
?>
2019-07-28 12:54:42
thank you UFFENO1 it works very well on the v3
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728