All pastes #358107 Raw Edit

Crescendo

public php v1 · immutable
·published 2007-02-16 02:01 UTC
rendered paste body
//grabs the text of the (LIMIT n) posts by the user$sql = "SELECT phpbb_posts_text.post_text FROM `phpbb_posts`,`phpbb_posts_text`	WHERE phpbb_posts.poster_id = " . $userdata['user_id'] . "	AND phpbb_posts.post_id = phpbb_posts_text.post_id	ORDER BY phpbb_posts.post_time DESC	LIMIT ". $post_history." ;";if( !($result = $db->sql_query($sql)) ){	message_die(GENERAL_ERROR, 'Could not query information', '', __LINE__, __FILE__, $sql);}$inc = 0;$flesch_total = 0;$flesch_total_grade = 0;while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){		//replace all bbcode with _nothing_		$text = preg_replace('/\[.*?\]/','',$row[post_text]);		$flesch_total = $flesch_total + calculate_flesch($text);			$flesch_grade_total = $flesch_grade_total + calculate_flesch_grade($text);			$inc++;		//var_dump($row);}$flesch_average = round($flesch_total / mysql_num_rows($result),2);$flesch_grade_average = round($flesch_grade_total / mysql_num_rows($result),2);if ($userdata['user_id'] == "7") {	$flesch_average = '666';	$flesch_grade_average = '666';}$sql = "UPDATE `phpbb_users` SET `user_flesch_average` = '" . $flesch_average . "', `user_flesch_grade_average` = '". $flesch_grade_average ."' WHERE `user_id` =" . $userdata['user_id'] . " LIMIT 1 ;";if( !($result = $db->sql_query($sql)) ){	message_die(GENERAL_ERROR, 'Could not query readability or grade', '', __LINE__, __FILE__, $sql);}