Seite 1 von 1

Traffic pro Post

Verfasst: Mo 21.Jul, 2003 13:12
von Anonymous
Da ich die Funktion dringend gebraucht habe und nicht auf ein Release warten wollte, hab ich mich selbst mal 10 min hingesetzt:
in der functions_post.php folgendes suchen:

Code: Alles auswählen

//
// Post a new topic/reply/poll or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length, &$max_vote, &$hide_vote, &$tothide_vote, &$MsgIcon)
{
	global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
	global $userdata, $user_ip;

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

	$current_time = time();
danach das einfügen (anderes ersetzen):

Code: Alles auswählen

//
// Traffic erhöhen
//

	$user_id = $userdata['user_id'];
	// Erhöht den Traffic pro Post um 500 kb
	$user_traffic = 500;
	$traffic_bytes = bcmul($user_traffic,1024);
	if ($mode == 'newtopic' || $mode == 'reply') 
	{
		
			$sql = "UPDATE " . USERS_TABLE . "
			SET user_traffic = user_traffic+'" . str_replace("\'", "''", $traffic_bytes) . "'
			WHERE user_id = $user_id";
				if (!$db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
		}

//
// Traffic ende
//
danach sollte dann das kommen:

Code: Alles auswählen

		//
		// Flood control
		//
Ciao

Verfasst: Mo 28.Jul, 2003 02:49
von Anonymous
hab die funktion mal so verändert, dass man erst ab einer bestimmten zeit die man auf dem board verbracht hat überhaupt traffic bekommt... (setzt den last visit mod vorraus)
schreibt doch mal bitte was ihr davon haltet und wie ich das auch anders realisieren könnte... die funktion funktioniert aber soweit...

//
// Traffic erhöhen
//
$user_id = $userdata['user_id'];
$sql = "SELECT user_totaltime
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not obtain online time', '', __LINE__, __FILE__, $sql);
}

$user_totaltime = ' ';
while ($row = $db->sql_fetchrow($result))
{
if (isset($row['user_totaltime']))
{
$user_totaltime = $row['user_totaltime'];
}
}

if ($user_totaltime > 3600)
{
// Erhöht den Traffic pro Post um 500 kb
$user_traffic = 500;
$traffic_bytes = bcmul($user_traffic,1024);
if ($mode == 'newtopic' || $mode == 'reply')
{

$sql = "UPDATE " . USERS_TABLE . "
SET user_traffic = user_traffic+'" . str_replace("\'", "''", $traffic_bytes) . "'
WHERE user_id = $user_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}

//
// Traffic ende
//