Просмотр файла includes/main_forum/addrazdel.php

Размер файла: 2.05Kb
<?php
if ($addmsg!='')
	{
	$addtopic=$addtopic+0;
	# Если повтор сообщения
	$q=mysql(DBName,"SELECT `l3` FROM `$table` WHERE 1 AND `text` = '$addmsg' AND `l2` = 0 AND `l3` = 0 LIMIT 0, 1");
	$s=mysql_num_rows($q)+0;
	$sysmsg='<b>Раздел уже добавлен.</b><br/>';
	if ($s>0) include($rootpath."main.php");
    @mysql(DBName,"UPDATE `$table` SET `l1` = `l1` + 1 WHERE `l1` > $addtopic ORDER BY `l1` DESC");
	@mysql(DBName,"INSERT INTO `$table` ( `l1` , `l2` , `l3` , `status` , `login` , `time` , `text` ) VALUES ( '".($addtopic+1)."', '0', '0', '0', '$login', '".time()."', '".$addmsg."')");
	$sysmsg='<b>Раздел добавлен.</b><br/>';
	include($rootpath."main.php");
	}

print '<card id="forum" title="'.$title.'Форум">';
print '<p>';
print 'Раздел:<br/>';
print '<input name="r" type="text" title="Раздел" value="" maxlength="20"/><br/>';

$q=mysql(DBName,"SELECT `l1` , `text` FROM `".$table."` WHERE 1 AND `l2` = 0 AND `l3` = 0 ORDER BY `l1` ASC LIMIT 0, 29");
$s=mysql_num_rows($q);

print 'Вставить после...<br/>';
print '<select name="pr" title="После..." value="0">';
print '<option value="0">в начало</option>';

for ($i=0;($i<$s);$i++)
	{
	$f=mysql_fetch_array($q);
	$text=cyr2utf(str_replace("$","$$",htmlspecialchars(stripslashes($f['text']))));
	$l1=$f['l1'];

    $q1=@mysql(DBName,"SELECT `status` FROM `$table` WHERE 1 AND `status` < 2 AND `l1` = $l1 AND `l2` != 0 AND `l3` = 0");
    $countertopic=@mysql_num_rows($q1)+0;

    $q1=@mysql(DBName,"SELECT `status` FROM `$table` WHERE 1 AND `status` < 2 AND `l1` = $l1 AND `l2` != 0 AND `l3` != 0");
    $countermsg=@mysql_num_rows($q1)+0;

	print '<option value="'.$l1.'">...'.$text.'</option>';
	}

print '</select><br/>';

print '<anchor>Добавить';
print '<go href="'.$forum.'/ar" method="post">';
print '<postfield name="at" value="$(pr)"/>';
print '<postfield name="am" value="$(r)"/>';
print '</go>';
print '</anchor><br/>';

print '<anchor>Назад<prev/></anchor>';
print $endtext;
exit();
?>