Verfasst: 17.05.2004 17:58
vielen vielen dank!!!
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
Could not update users table
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax near ''10', '25', '25', user_posts_per_page = '10', user_topics_per_page = '25', user_' at line 2
...(die Daten stehen hier)
Line : 459
File : /var/www/www.rage3d.de/forum/includes/usercp_register.php
Code: Alles auswählen
#####################################################################################
##
## Hack Title: Post per page / Topics per page / Hot Threshold adjustable
## for every user in his profile
## Hack Version: 1.0
## Author: Acid < acid_junky@web.de >
## Description: every user can adjust how much posts/topics should be displayed
## and hot threshold.
##
## Files To Edit: 5
## language/lang_xxx/lang_main.php
## includes/usercp_register.php
## viewforum.php
## viewtopic.php
## templates/xxx/profile_add_body.tpl
##
#####################################################################################
##
## Installation/Author Notes:
## First always make a back-up from the files that you're going to edit.
##
## This hack adds three new fields to your 'user' table.
#####################################################################################
>>SQL QUERY: (You may have to change your database prefix)
ALTER TABLE phpbb_users ADD user_topics_per_page VARCHAR(5);
ALTER TABLE phpbb_users ADD user_hot_threshold VARCHAR(5);
ALTER TABLE phpbb_users ADD user_posts_per_page VARCHAR(5);
UPDATE phpbb_users SET user_topics_per_page=50;
UPDATE phpbb_users SET user_posts_per_page=15;
UPDATE phpbb_users SET user_hot_threshold=15;
>>alternate you can use per_page_db_install.php to alter the database automatically
>>(just upload and run the file)
#############################################################################################################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
# language/lang_xxx/lang_main.php
>>FIND:
$lang['No_send_account_inactive'] = 'Sorry, but your password cannot be retrieved because your account is currently inactive. Please contact the forum administrator for more information';
>>ADD BELOW:
$lang['Topics_per_page'] = 'Topics Per Page';
$lang['Posts_per_page'] = 'Posts Per Page';
$lang['Hot_threshold'] = 'Posts for Popular Threshold';
#############################################################################################################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
# 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 . "
>>FIND IN THIS LINE:
user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "'
>>ADD AFTER:
, user_posts_per_page = '" . str_replace("\'", "''", $user_posts_per_page) . "', user_topics_per_page = '" . str_replace("\'", "''", $user_topics_per_page) . "', user_hot_threshold = '" . str_replace("\'", "''", $user_hot_threshold) . "'
--------------------------------------------------------------------------------------------------
>>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("\'", "''", $new_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, ";
>>FIND IN THIS LINE:
user_dateformat
>>ADD AFTER:
, user_posts_per_page, user_topics_per_page, user_hot_threshold
>>FIND IN THIS LINE:
'" . str_replace("\'", "''", $user_dateformat) . "'
>>ADD AFTER:
, '" . str_replace("\'", "''", $user_posts_per_page) . "', '" . str_replace("\'", "''", $user_topics_per_page) . "', '" . str_replace("\'", "''", $user_hot_threshold) . "'
--------------------------------------------------------------------------------------------------
>>FIND:
'ALWAYS_ALLOW_SMILIES_NO' => ( !$allowsmilies ) ? 'checked="checked"' : '',
>>ADD BELOW:
'POSTS_PER_PAGE' => ( $userdata['user_posts_per_page'] == '' ) ? $board_config['posts_per_page'] : $userdata['user_posts_per_page'],
'TOPICS_PER_PAGE' => ( $userdata['user_topics_per_page'] == '' ) ? $board_config['topics_per_page'] : $userdata['user_topics_per_page'],
'HOT_TOPIC' => ( $userdata['user_hot_threshold'] == '' ) ? $board_config['hot_threshold'] : $userdata['user_hot_threshold'],
--------------------------------------------------------------------------------------------------
>>FIND:
'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
>>ADD BELOW:
'L_HOT_THRESHOLD' => $lang['Hot_threshold'],
'L_POSTS_PER_PAGE' => $lang['Posts_per_page'],
'L_TOPICS_PER_PAGE' => $lang['Topics_per_page'],
#############################################################################################################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
# viewforum.php
>>FIND:
// Grab all the basic data (all topics except announcements)
// for this forum
//
>>ADD BELOW:
if ( $userdata['user_topics_per_page'] == '' )
{
$per_page = $board_config['topics_per_page'];
}
else
{
$per_page = $userdata['user_topics_per_page'];
}
--------------------------------------------------------------------------------------------------
>>FIND:
LIMIT $start, ".$board_config['topics_per_page'];
>>REPLACE WITH:
LIMIT $start, ".$per_page;
--------------------------------------------------------------------------------------------------
>>FIND:
'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
>>REPLACE WITH:
'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $per_page )),
--------------------------------------------------------------------------------------------------
>>FIND:
if($replies >= $board_config['hot_threshold'])
>>REPLACE WITH:
if($replies >= $userdata['user_hot_threshold'])
--------------------------------------------------------------------------------------------------
>>FIND:
if( ( $replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
if( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
>>REPLACE WITH:
if( ( $replies + 1 ) > $userdata['user_posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $userdata['user_posts_per_page'] );
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $userdata['user_posts_per_page'])
{
$goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>';
if( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
$j += ( $total_pages - 4 ) * $userdata['user_posts_per_page'];
#############################################################################################################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
# viewtopic.php
>>FIND:
//
// Go ahead and pull all data for this topic
//
>>ADD BELOW:
if ( $userdata['user_posts_per_page'] == '' )
{
$per_page = $board_config['posts_per_page'];
}
else
{
$per_page = $userdata['user_posts_per_page'];
}
--------------------------------------------------------------------------------------------------
>>FIND:
LIMIT $start, ".$board_config['posts_per_page'];
>>REPLACE WITH:
LIMIT $start, ".$per_page;
--------------------------------------------------------------------------------------------------
>>FIND:
$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=" . $HTTP_GET_VARS['highlight'], $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
>>REPLACE WITH:
$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=" . $HTTP_GET_VARS['highlight'], $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $per_page, $start);
--------------------------------------------------------------------------------------------------
>>FIND:
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $total_replies / $board_config['posts_per_page'] )),
>>REPLACE WITH:
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_replies / $per_page )),
#############################################################################################################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
# templates/xxx/profile_add_body.tpl
>>FIND:
<input type="radio" name="allowsmilies" value="0" {ALWAYS_ALLOW_SMILIES_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
>>ADD BELOW:
<tr>
<td class="row1">{L_TOPICS_PER_PAGE}</td>
<td class="row2"><input type="text" name="user_topics_per_page" size="3" maxlength="4" value="{TOPICS_PER_PAGE}" /></td>
</tr>
<tr>
<td class="row1">{L_POSTS_PER_PAGE}</td>
<td class="row2"><input type="text" name="user_posts_per_page" size="3" maxlength="4" value="{POSTS_PER_PAGE}" /></td>
</tr>
<tr>
<td class="row1">{L_HOT_THRESHOLD}</td>
<td class="row2"><input type="text" name="user_hot_threshold" size="3" maxlength="4" value="{HOT_TOPIC}" /></td>
</tr>
#############################################################################################################################################################################################
#############################################################################################################################################################################################
#############################################################################################################################################################################################
Vermutlich.Woran kann das liegen? Ist was in der usercp_register.php falsch?
Code: Alles auswählen
$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_title, 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 = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_posts_per_page = '" . str_replace("\'", "''", $user_posts_per_page) . "', user_topics_per_page = '" . str_replace("\'", "''", $user_topics_per_page) . "', user_hot_threshold = '" . str_replace("\'", "''", $user_hot_threshold) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'" . $avatar_sql . "
WHERE user_id = $user_id";
Code: Alles auswählen
$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_posts_per_page, user_topics_per_page, user_hot_threshold, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_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, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_posts_per_page) . "', '" . str_replace("\'", "''", $user_topics_per_page) . "', '" . str_replace("\'", "''", $user_hot_threshold) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
Code: Alles auswählen
#
#-----[ OPEN ]-----
#
includes/usercp_register.php
#
#-----[ FIND ]-----
#
$viewemail = ( isset($HTTP_POST_VARS['viewemail']) ) ? ( ($HTTP_POST_VARS['viewemail']) ? TRUE : 0 ) : 0;
#
#-----[ AFTER, ADD ]-----
#
$user_posts_per_page = abs( intval($HTTP_POST_VARS['user_posts_per_page']) );
$user_topics_per_page = abs( intval($HTTP_POST_VARS['user_topics_per_page']) );
$user_hot_threshold = abs( intval($HTTP_POST_VARS['user_hot_threshold']) );
#
#-----[ FIND ]-----
#
if ( !$error )
{
if ( $mode == 'editprofile' )
{
#
#-----[ AFTER, ADD ]-----
#
$user_posts_per_page = ( intval($user_posts_per_page) == 0 ) ? $board_config['posts_per_page'] : $user_posts_per_page;
$user_topics_per_page = ( intval($user_topics_per_page) == 0 ) ? $board_config['topics_per_page'] : $user_topics_per_page;
$user_hot_threshold = ( intval($user_hot_threshold) == 0) ? $board_config['hot_threshold'] : $user_hot_threshold;
#
#-----[ FIND ]-----
#
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password
#
#-----[ BEFORE, ADD ]-----
#
$user_posts_per_page = ( intval($user_posts_per_page) == 0 ) ? $board_config['posts_per_page'] : $user_posts_per_page;
$user_topics_per_page = ( intval($user_topics_per_page) == 0 ) ? $board_config['topics_per_page'] : $user_topics_per_page;
$user_hot_threshold = ( intval($user_hot_threshold) == 0) ? $board_config['hot_threshold'] : $user_hot_threshold;
#
#-----[ FIND ]-----
#
$user_dateformat = $userdata['user_dateformat'];
#
#-----[ AFTER, ADD ]-----
#
$user_posts_per_page = ( $userdata['user_posts_per_page'] == '' ) ? $board_config['posts_per_page'] : $userdata['user_posts_per_page'];
$user_topics_per_page = ( $userdata['user_topics_per_page'] == '' ) ? $board_config['topics_per_page'] : $userdata['user_topics_per_page'];
$user_hot_threshold = ( $userdata['user_hot_threshold'] == '' ) ? $board_config['hot_threshold'] : $userdata['user_hot_threshold'];
#
#-----[ SAVE/CLOSE ALL FILES ]-----
#
# EoM