Parašė Narysx· 2010 Sau. 17 20:01:42
#6
Nu va ką aš radau fusione:
if ((iMOD || iSUPERADMIN) && isset($_POST['delete_posts']) && (isset($_POST['delete_post'])) && is_array($_POST['delete_post']) && count($_POST['delete_post'])) {
$del_posts = ""; $i = 0; $post_count = 0;
foreach ($_POST['delete_post'] as $del_post_id) {
if (isnum($del_post_id)) { $del_posts .= ($del_posts ? "," : "").$del_post_id; $i++; }
}
if ($del_posts) {
$result = dbquery("SELECT post_author, COUNT(post_id) as num_posts FROM ".DB_POSTS." WHERE post_id IN (".$del_posts.") GROUP BY post_author");
if (dbrows($result)) {
while ($pdata = dbarray($result)) {
$result2 = dbquery("UPDATE ".DB_USERS." SET user_posts=user_posts-".$pdata['num_posts']." WHERE user_id='".$pdata['post_author']."'");
$post_count = $post_count + $pdata['num_posts'];
$result = dbquery("DELETE FROM ".DB_POSTS." WHERE thread_id='".$_GET['thread_id']."' AND post_id IN(".$del_posts.")");
if (iMOD) { echo "<div style='float:right'><input type='checkbox' name='delete_post[]' value='".$data['post_id']."' /></div>\n"; }
echo "<a href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',1);return false;\">".$locale['460']."</a> ::\n";
echo "<a href='#' onclick=\"javascript:setChecked('mod_form','delete_post[]',0);return false;\">".$locale['461']."</a></td>\n";
echo "<td align='right' style='padding-top:5px'><input type='submit' name='delete_posts' value='".$locale['517']."' class='button' onclick=\"return confirm('".$locale['518']."');\" /></td>\n";
Ir kaip man dbr visa tai pritaikyt prie savo užkl.? :/