[Beta] Timeslip Database

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

[Beta] Timeslip Database

Postby LS1 TA » Thu Jul 04, 2002 10:53 pm

Hi,

I wasn't planning on releasing this little add-on/mod because theres probably not that many people here who would find it useful, but one of the moderators suggested that I release it anyway because someone might be able to alter it a bit and use it for other things.. So I'll post it here.

What is it? I call it the TimeSlip Database. I have a Musclecar website, and this mod allows my members to submit their best 1/4 mile timeslip info & the type of car they have, and then it ranks them from quickest to slowest and displays them on this page:
http://modernmusclecars.net/phpBB2/timeslips.php
Note: this is a live forum, so please don't submit bogus times just to try it out.

How does it work? Its actually a two part mod.. In order to use my mod, you must first use the Real Names Mod (aka add extra fields mod) by Rod to add 4 new fields. It allows your members to submit their 1/4 mile timeslip info in their Profile. Then the timeslips.php page calls up the info from the new fields and ranks them by the numbers entered in the 1/4 mile ET field.

What else could this mod be used for? With a few changes, this mod could also be used on gaming websites to rank members by their highest score. Basically, anything that has to do ranking by numbers.

Like I said, this is a two part mod. The first part is the Real Names mod by Rod. I will repost his mod here (included with my mod) with the correct field names already added to make things easier.

Note: This has been tested for phpBB 2.0.0 and 2.0.1. You might need to make some changes for later versions.)

##############################################################
## MOD Title: phpBB Timeslip Database / Real Names Mod
## MOD Version: 1.0.0
## Timeslip Database mod Author: LS1 TA < Webmaster@ModernMusclecars.net > (Dewayne Parrish) www.ModernMuscleCars.net
## Real Names Mod Author: Rod (Rod Davis)
## Description: This mod lets your members submit thier 1/4 mile timeslip info & the type of car they own in their profile, and then ranks them from quickest to slowest on the included php page.
##
## Installation Level: (easy/moderate)
## Installation Time: 10-15 Minutes
## Files To Edit: usercp_register.php,
## lang_main.php,
## profile_add_body.tpl,
## usercp_viewprofile.php,
admin_users.php,
user_edit_body.tpl ,

## Included Files: timeslips.php
timeslips.tpl
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
##
Step 1:
#
#-----[ ACTION ]------------------------------------------
#
# You will need to add four new fields into your users table in your SQL database.

SQL-query:
ALTER TABLE users ADD user_ride VARCHAR (25)
ALTER TABLE users ADD user_sixty VARCHAR (5)
ALTER TABLE users ADD user_eighth VARCHAR (14)
ALTER TABLE users ADD user_quarter VARCHAR (14)


##
## The number in parenthasis specifies the field size so if you want 50 characters then change it to (50).
##
## If you have a table prefix then put it before users
## For example, if phpbb is the prefix then the above becomes:
##
## ALTER TABLE phpbb_users ADD user_ride VARCHAR (25)
## ALTER TABLE phpbb_users ADD user_sixty VARCHAR (5)
##ALTER TABLE phpbb_users ADD user_eighth VARCHAR (14)
##ALTER TABLE phpbb_users ADD user_quarter VARCHAR (14)
##
##
Step 2:
#
#----- [ OPEN ] -------------------------------------
# This first section modifies registration and profile to allow your members to input the timeslip info

phpBB2/includes/usercp_register.php

#
#----- [ FIND ] -------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "

#
#----- [ REPLACE WITH ] -------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_sig_bbcode_uid = '$signature_bbcode_uid', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . ", user_ride = '" . str_replace("\'", "''", $ride) . "', user_sixty = '" . str_replace("\'", "''", $sixty) . "', user_eighth = '" . str_replace("\'", "''", $eighth) . "', user_quarter = '" . str_replace("\'", "''", $quarter) . "'


#
#----- [ FIND ] -------------------------------------
#

$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";

#
#----- [ REPLACE WITH ] -------------------------------------
#

$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_ride, user_sixty, user_eighth, user_quarter, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, '$ride', '$sixty', '$eighth', '$quarter', ";

#
#----- [ FIND ] -------------------------------------
#

$username = htmlspecialchars($userdata['username']);


#
#----- [ ADD AFTER ] -------------------------------------
#

$ride = htmlspecialchars($userdata['user_ride']);
$sixty = htmlspecialchars($userdata['user_sixty']);
$eighth = htmlspecialchars($userdata['user_eighth']);
$quarter = htmlspecialchars($userdata['user_quarter']);

#
#----- [ FIND ] -------------------------------------
#

display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat);

#
#----- [ REPLACE WITH ] -------------------------------------
#

display_avatar_gallery($mode, $avatar_category, $user_id, $email, $current_email, $coppa, $username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $viewemail, $notifypm, $popuppm, $notifyreply, $attachsig, $allowhtml, $allowbbcode, $allowsmilies, $allowviewonline, $user_style, $user_lang, $user_timezone, $user_dateformat, $user_ride, $user_sixty, $user_eighth, $user_quarter);

#
#----- [ FIND ] -------------------------------------
#

$template->assign_vars(array(
'USERNAME' => $username,

#
#----- [ ADD AFTER ] -------------------------------------

'RIDE' => $ride,
'SIXTY' => $sixty,
'EIGHTH' => $eighth,
'QUARTER' => $quarter,

#
#----- [ FIND ] ----------------------------
#

'L_EMAIL_ADDRESS' => $lang['Email_address'],

#
#----- [ ADD AFTER ] -------------------------------------
#

'L_RIDE' => $lang['ride'],
'L_SIXTY' => $lang['sixty'],
'L_EIGHTH' => $lang['eighth'],
'L_QUARTER' => $lang['quarter'],

#
#----- END OF CHANGES TO usercp_register -------------------------------------
#

#
#----- We now need to change the language file -------------------------------------
#

#
#-----[ OPEN ]------------------------------------------
#
# Remember to do this for every language you support
# It needs translating!!!

phpBB2/language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

//
// Errors (not related to a
// specific failure on a page)
//
$lang['Information'] = "Information";
$lang['Critical_Information'] = "Critical Information";

#
#-----[ ADD, BEFORE ]------------------------------------------
#

//
// Language variables for the new field in user profile
//

$lang['ride'] = "Ride";
$lang['sixty'] = "60 ft time";
$lang['eighth'] = "1/8 mile ET and MPH";
$lang['quarter'] = "1/4 mile ET and MPH";

#
#----- Now we need to edit the profile template file so users can add it to their profile ----
#

#
#-----[ OPEN ]------------------------------------------
#
# Remember to do this for every template you support


phpBB2/templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>


#
#-----[ AFTER, ADD ]------------------------------------------
#
# Note: you want the maxlength to be the same as the
# field size you specified when adding field to the database!
#

<tr>
<td class="row1"><span class="gen">{L_RIDE}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="ride" size="10" maxlength="25" value="{RIDE}" />
</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_SIXTY}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="sixty" size="10" maxlength="5" value="{SIXTY}" />
</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_EIGHTH}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="eighth" size="10" maxlength="14" value="{EIGHTH}" />
</td>
<tr>
<td class="row1"><span class="gen">{L_QUARTER}:<p><B>Important!</b> If your car runs single digit ETs, enter a "0" first. Example: 08.546@165.72 </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="quarter" size="10" maxlength="14" value="{QUARTER}" />
<br>
<span class="gen">Example: 12.892@108.45 (No spaces)<br> Do <b>NOT</b> submit bogus ETs!</span>
</td>
</tr>


#
#---------- OK, Users can now register with the timeslip info and ---------------
#---------- edit thier profile to change it ------------------------
#
#
#
#
Step 3:
#
#--------- This will allow the timeslip info to be viewed in the member's profile
#

#
#-----[ OPEN ]------------------------------------------
#
# This adds the timeslip info into the users profile
#

phpBB2/includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#

'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',

#
#-----[ ADD AFTER ]------------------------------------------
#

'RIDE' => ( $ride ) ? $ride : '&nbsp;',
'SIXTY' => ( $sixty ) ? $sixty : '&nbsp;',
'EIGHTH' => ( $eighth ) ? $eighth : '&nbsp;',
'QUARTER' => ( $quarter ) ? $quarter : '&nbsp;',

#
#-----[ FIND ]------------------------------------------
#

//
// Generate page
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

$ride = $profiledata['user_ride'];
$sixty = $profiledata['user_sixty'];
$eighth = $profiledata['user_eighth'];
$quarter = $profiledata['user_quarter'];

#
#-----[ FIND ]------------------------------------------
#

'L_INTERESTS' => $lang['Interests'],

#
#-----[ ADD AFTER ]------------------------------------------
#

'L_RIDE' => $lang['ride'],
'L_SIXTY' => $lang['sixty'],
'L_EIGHTH' => $lang['eighth'],
'L_QUARTER' => $lang['quarter'],

#
#-----[ OPEN ]------------------------------------------
#
# Remember to do this for every template you support


phpBB2/templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_JOINED}:&nbsp;</span></td>

#
#-----[ BEFORE, ADD ]----------------------------------------
#

<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_RIDE}:&nbsp;</span></td>
<td><b><span class="gen">{RIDE}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_SIXTY}:&nbsp;</span></td>
<td><b><span class="gen">{SIXTY}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_EIGHTH}:&nbsp;</span></td>
<td><b><span class="gen">{EIGHTH}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_QUARTER}:&nbsp;</span></td>
<td><b><span class="gen">{QUARTER}</span></b></td>
</tr>

#
#------ Now the timeslip info can be seen in the users profile
##
##
##
Step 4:
This makes it possible for you to go into the admin control panel and change or delete the timeslip info that your members submit.
#
#----- [ OPEN ] -------------------------------------
#

phpBB2/admin/admin_users.php

#
#----- [ FIND ] -------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "


#
#----- [ REPLACE WITH ] -------------------------------------
#

$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . ", user_ride = '" . str_replace("\'", "''", $ride) . "', user_sixty = '" . str_replace("\'", "''", $sixty) . "', user_eighth = '" . str_replace("\'", "''", $eighth) . "', user_quarter = '" . str_replace("\'", "''", $quarter) . "'


#
#----- [ FIND ] -------------------------------------
#

$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags( $HTTP_POST_VARS['username'] ) ) : '';


#
#----- [ ADD AFTER ] -------------------------------------
#

$ride = ( !empty($HTTP_POST_VARS['ride']) ) ? trim(strip_tags( $HTTP_POST_VARS['ride'] ) ) : '';
$sixty = ( !empty($HTTP_POST_VARS['sixty']) ) ? trim(strip_tags( $HTTP_POST_VARS['sixty'] ) ) : '';
$eighth = ( !empty($HTTP_POST_VARS['eighth']) ) ? trim(strip_tags( $HTTP_POST_VARS['eighth'] ) ) : '';
$quarter = ( !empty($HTTP_POST_VARS['quarter']) ) ? trim(strip_tags( $HTTP_POST_VARS['quarter'] ) ) : '';

#
#----- [ FIND ] -------------------------------------
#

validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);

#
#----- [ RePLACE WITH ] -------------------------------------
#

validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $ride, $sixty, $eighth, $quarter);

#
#----- [ FIND ] -------------------------------------
#
# There are 2 instances of this. Do it for both!

$username = stripslashes($username);


#
#----- [ ADD AFTER ] -------------------------------------
#

$ride = stripslashes($ride);
$sixty = stripslashes($sixty);
$eighth = stripslashes($eighth);
$quarter = stripslashes($quarter);

#
#----- [ FIND ] -------------------------------------
#

$username = $this_userdata['username'];


#
#----- [ ADD AFTER ] -------------------------------------
#

$ride = $this_userdata['user_ride'];
$sixty = $this_userdata['user_sixty'];
$eighth = $this_userdata['user_eighth'];
$quarter = $this_userdata['user_quarter'];


#
#----- [ FIND ] -------------------------------------
#


$s_hidden_fields .= '<input type="hidden" name="username" value="' . str_replace("\"", "&quot;", $username) . '" />';

#
#----- [ ADD AFTER ] -------------------------------------
#

$s_hidden_fields .= '<input type="hidden" name="ride" value="' . str_replace("\"", "&quot;", $ride) . '" />';
$s_hidden_fields .= '<input type="hidden" name="sixty" value="' . str_replace("\"", "&quot;", $sixty) . '" />';
$s_hidden_fields .= '<input type="hidden" name="eighth" value="' . str_replace("\"", "&quot;", $eighth) . '" />';
$s_hidden_fields .= '<input type="hidden" name="quarter" value="' . str_replace("\"", "&quot;", $quarter) . '" />';

#
#----- [ FIND ] -------------------------------------
#

$template->assign_vars(array(
'USERNAME' => $username,

#
#----- [ ADD AFTER ] -------------------------------------
#

"RIDE" => $ride,
"SIXTY" => $sixty,
"EIGHTH" => $eighth,
"QUARTER" => $quarter,


#
#----- [ FIND ] ----------------------------
#

'L_EMAIL_ADDRESS' => $lang['Email_address'],

#
#----- [ ADD AFTER ] -------------------------------------
#

"L_RIDE" => $lang['ride'],
"L_SIXTY" => $lang['sixty'],
"L_EIGHTH" => $lang['eighth'],
"L_QUARTER" => $lang['quarter'],

#
#----- END OF CHANGES TO admin_users.php -------------------------------------
#

#
#-----[ OPEN ]------------------------------------------
# This section puts the entry fields into admin editing pofile.
#
# Remember to do this for every template you support




phpBB2/templates/subSilver/admin/user_edit_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<tr>
<td class="row1"><span class="gen">{L_WEBSITE}</span></td>
<td class="row2">
<input type="text" name="website" size="35" maxlength="255" value="{WEBSITE}" />
</td>
</tr>


#
#-----[ AFTER ADD ]------------------------------------------
#
#

<tr>
<td class="row1"><span class="gen">{L_RIDE}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="ride" size="10" maxlength="25" value="{RIDE}" />
</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_SIXTY}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="sixty" size="10" maxlength="5" value="{SIXTY}" />
</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_EIGHTH}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="eighth" size="10" maxlength="14" value="{EIGHTH}" />
</td>
</tr>
<tr>
<td class="row1"><span class="gen">{L_QUARTER}: </span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="quarter" size="10" maxlength="14" value="{QUARTER}" />
</td>
</tr>
##
##
Step 5:
Copy the two files below and name them timeslips.php and timeslips.tpl .. Upload timeslips.php to your phpBB root dirrectory (phpBB2/), and upload timeslips.tpl to your templates dirrectory (phpBB2/templates/yourtemplate/ ).


timeslips.php
Code: Select all
<?php

define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);


$start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;


//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);
init_userprefs($userdata);
//
// End session management
//

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);


$template->set_filenames(array(
"body" => "timeslips.tpl")
);


$sql = "SELECT user_id, username, user_ride, user_sixty, user_eighth, user_quarter
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
AND user_quarter > 0
ORDER BY user_quarter ASC
LIMIT $start, " . $board_config['topics_per_page'];

if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, "Couldn't retrieve users data", "", __LINE__, __FILE__, $sql);
}

$user_count = $db->sql_numrows($result);
$user_data = $db->sql_fetchrowset($result); 
$firstcount = $user_data[0]['user_quarter'];

for ($i = 0; $i < $user_count; $i++)
{

$template->assign_block_vars("users", array(   
"RANK" => $i+ ( $HTTP_GET_VARS['start'] + 1 ),
"USERNAME" => $user_data[$i]['username'],
"URL" => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $user_data[$i]['user_id'],
"RIDE" => $user_data[$i]['user_ride'],
"SIXTY" => $user_data[$i]['user_sixty'],
"EIGHTH" => $user_data[$i]['user_eighth'],
"QUARTER" => $user_data[$i]['user_quarter'])

   );
}
$sql = "SELECT count(*) AS total
   FROM " . USERS_TABLE . "
   WHERE user_id <> " . ANONYMOUS . "
   AND user_quarter > 0";

if ( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
}

   if ( $total = $db->sql_fetchrow($result) )
{
   $total_members = $total['total'];
         
}
$template->assign_vars(array(
"PAGINATION" => generate_pagination("timeslips.$phpEx?order=$sort_order", $total_members, $board_config['topics_per_page'], $start),
      "PAGE_NUMBER" => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_members / $board_config['topics_per_page'] )),

      "L_GOTO_PAGE" => $lang['Goto_page'])

);

//
//Output the page
// 
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->pparse("body");

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);


?>




timeslips.tpl
Code: Select all
<div align="center"><center>

<table border="0" cellpadding="2" cellspacing="1" width="100%">
    <caption align="top"><font color="#FF0000" size="3"><strong>Timeslip Database</strong></font></caption>
    <tr>
        <td class="catLeft" align="center" width="25%"><span class="cattitle">Username</span></td>
        <td class="catLeft" align="center" width="25%"><span class="cattitle">Ride</span></td>
        <td class="catLeft" align="center" width="10%"><span class="cattitle">60'
        Time</span></td>
        <td class="catLeft" align="center" width="20%"><span class="cattitle">1/8
        Mile ET &amp; MPH</span></td>
        <td class="catLeft" align="center" width="20%"><span class="cattitle">1/4
        Mile ET &amp; MPH</span></td>
    </tr>
</table>
</center></div>

<!-- BEGIN users -->
<div align="center"><center>
<table border="0" cellpadding="2" cellspacing="1" width="100%">   
<tr>
        <td class="row1" width="25%"><span class="genmed">{users.RANK}.</span> <a href="{users.URL}"><span class="genmed">{users.USERNAME}</a></span><br></td>
        <td class="row1" width="25%"><span class="genmed">{users.RIDE}</span><br></td>
        <td class="row1" width="10%"><span class="genmed">{users.SIXTY}</span><br></td>
        <td class="row1" width="20%"><span class="genmed">{users.EIGHTH}</span><br></td>
        <td class="row1" width="20%"><span class="genmed">{users.QUARTER}</span><br></td>
    </tr>
</table>
</center></div>
  <!-- END users -->
<div align="center"><center>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr>   
<td align="right" valign="middle" nowrap="nowrap"><br /><span class="nav">{PAGINATION}</span>
      </td>
   </tr>
   <tr>
     <td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
   </tr>
</table>
</center></div>
<p>


Save & Upload all files


Thats it! Just add a link to timeslips.php somewhere on your forum or main page.

Credits: Real Names Mod by: Rod Davis
http://www.phpbb.com/phpBB/viewtopic.php?t=15421
Thanks to Shannado for his help with the pagination.

Later,
Dewayne
Last edited by LS1 TA on Sun Nov 03, 2002 11:24 am, edited 10 times in total.
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby LS1 TA » Fri Jul 05, 2002 6:06 am

......
Last edited by LS1 TA on Fri Jul 05, 2002 7:43 am, edited 1 time in total.
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby Steve-G » Fri Jul 05, 2002 7:02 am

Looks like a sweet mod. Too bad I'm pretty poor at php or I'd take a crack at it. I hope someone helps. :)
User avatar
Steve-G
Registered User
 
Posts: 35
Joined: Tue Apr 30, 2002 6:26 am

Postby custmguru® » Fri Jul 05, 2002 3:53 pm

there are people out there who can get some use from it. we operate an S-10 forum and had this on our site. we have been looking for a mod like this. thanks!
User avatar
custmguru®
Registered User
 
Posts: 233
Joined: Wed Apr 10, 2002 6:06 pm
Location: Somewhere, Over the rainbow

asd

Postby Manutencao » Fri Jul 05, 2002 6:11 pm

awd
User avatar
Manutencao
Registered User
 
Posts: 28
Joined: Fri Jul 05, 2002 2:41 pm

Postby LS1 TA » Fri Jul 05, 2002 11:41 pm

custmguru® wrote:there are people out there who can get some use from it. we operate an S-10 forum and had this on our site. we have been looking for a mod like this. thanks!


Cool. Glad to hear that someone finds it useful. Hope it works out for you.

Nice site BTW. I've been there before. :)
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby LS1 TA » Sat Jul 27, 2002 11:19 am

Solved. ;)
Last edited by LS1 TA on Tue Aug 13, 2002 10:45 am, edited 1 time in total.
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby LS1 TA » Sun Jul 28, 2002 7:00 am

Any help with this?
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby Grinch » Fri Aug 02, 2002 7:46 pm

I don't think I can help you with the PHP thing, but I run a car club in Toronto, Canada. I might be able to use something like this. :D
Grinch
Registered User
 
Posts: 396
Joined: Mon Apr 22, 2002 5:44 pm
Location: Toronto, Canada

Postby LS1 TA » Sat Aug 03, 2002 4:22 am

Cool, glad to see more that more people find it useful. :)
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby LS1 TA » Fri Sep 20, 2002 5:52 am

I've added the ability to sort by 60' time, 1/8 mile time, or 1/4 mile time.. Optionally, you can add the aspiration type (turbo, nitrous, supercharger, or all motor) for the cars and sort by it aswell (see demo). If anyone wants the latest version, just let me know. 8)
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby Grinch » Sun Oct 06, 2002 10:50 pm

Someone from my car club was requesting a way to see what mods are associated with the time slip. Motor type is good, but there's so much more than just a motor.

ie

- catback exhaust
- headers
- cam
- rockers
- suspension mods
- etc etc etc

There could be just a simple text box with some details about the car, or even better, car mods which were "checked off" from a list by the user. (the list would be pre-defined by the admin)

Maybe there's a similar mod out there that can do the list thing. I'll take a look for one.
Grinch
Registered User
 
Posts: 396
Joined: Mon Apr 22, 2002 5:44 pm
Location: Toronto, Canada

Postby LS1 TA » Sun Oct 06, 2002 11:00 pm

Grinch,
You can use the "Real Names" mod to add as many new fields as you want. Then just add the new fields to timeslips.php & timeslips.tpl.

Real Names Mod:
http://www.phpbb.com/phpBB/viewtopic.php?t=15421

Maybe there's a similar mod out there that can do the list thing. I'll take a look for one.

With a few modifications that can be done with the Gender Mod. Just be sure to use the latest version because there was a security problem with the earlier ones.
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Postby Grinch » Thu Oct 31, 2002 3:48 am

I've finally found some time to add this mod to my board, So far it's working great. I'm just about to add the admin section, but I came across what might be a little type-o.
Code: Select all
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_posts = $user_posts, user_rank = $user_rank" . $avatar_sql . ", user_ride = '" . str_replace("\'", "''", $ride) . "', user_sixty = '" . str_replace("\'", "''", $sixty) . "', user_eighth = '" . str_replace("\'", "''", $eighth) . "', user_quarter = '" . str_replace("\'", "''", $quarter) . "'


Just before the spot where you added the lines for the Time Slip stuff in the code above, right before user_rank, you have user_posts = $user_posts. This isn't in the original code. Does this belong to some other mod on your board, or does that variable really need to be in there?
Grinch
Registered User
 
Posts: 396
Joined: Mon Apr 22, 2002 5:44 pm
Location: Toronto, Canada

Postby LS1 TA » Thu Oct 31, 2002 6:29 am

Grinch,
Sorry about that. :oops: And thanks for pointing it out. Its from another mod that I added which allows me to edit the user's post count, so just remove it.
I updated my original post btw.

Take care,
Dewayne
LS1 TA
Registered User
 
Posts: 155
Joined: Wed Jan 16, 2002 9:38 pm

Next

Return to [2.0.x] MODs in Development

Who is online

Users browsing this forum: No registered users and 3 guests