Просмотр файла news-mysql/news/admin/opinion.php

Размер файла: 3.72Kb
<?
include "cfg.php";
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
print '<?xml version="1.0" encoding="utf-8"?>';
print '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';
print '<card title="'.$lang['news'].'">'.
'<p align="left">';
$fl='false';
if (@$act=='add')
	if (empty($text)){
		print '<b>'.$lang['opinion'].'</b><br/>';
		print $lang['name'].':<br/>
		<input title="Name" name="name" maxlength="20"/><br/>
		'.$lang['text'].':<br/>
		<input title="Text" name="text" maxlength="255"/><br/>
		<anchor>'.$lang['add'].'
		<go href="opinion.php?act=add&amp;pass='.$pass.'" method="post">
		<postfield name="name" value="$(name)"/>
		<postfield name="text" value="$(text)"/>
		<postfield name="id" value="'.$id.'"/>
		</go></anchor>';
	} else
	{
		$text=htmlspecialchars($text);
		$text=str_replace('$','$$', $text);
		$name=htmlspecialchars($name);
		$name=str_replace('$','$$', $name);
		$q2=mysql_query("select id from `news_com` where text='$text';");
		if (mysql_num_rows($q2)<1)
		mysql_query("insert into `news_com` values(0,'$id','".time()."','$name','$text');");
		$fl='true';
	}
else if (@$act=='golos')
if (empty($op)){
print '<b>'.$lang['que'].'</b><br/>';
print '<a href="opinion.php?act=golos&amp;id='.$id.'&amp;op=plus&amp;pass='.$pass.'">'.$lang['good'].'</a><br/>';
print '<a href="opinion.php?act=golos&amp;id='.$id.'&amp;op=minus&amp;pass='.$pass.'">'.$lang['bad'].'</a><br/>';
} else
{
$ipsoft=getenv("REMOTE_ADDR").'**'.getenv("HTTP_USER_AGENT");
$q3=mysql_query("select plus, minus, ipsoft from news where id='$id'");
$r3=mysql_fetch_array($q3);
if ($ipsoft!=$r3['ipsoft']) mysql_query("update news set $op='".($r3[$op]+1)."', ipsoft='$ipsoft' where id=$id;");
$fl=true;
};
if (@$act=='del') {mysql_query("delete from `news_com` where id=$mid;"); $fl=true;};
if ((empty($act))||$fl=='true'){
if (!@$s) $s=0;
$q=mysql_query("select count(id) from `news_com` where nid='$id';");
$r=mysql_fetch_array($q);
$count=$r['count(id)'];
if ($s*$lim+$lim>$count) $limit=$count-$s*$lim; else $limit=$lim;
if ((@$act!='add')&&(empty($text))) print '<a href="opinion.php?act=add&amp;id='.$id.'&amp;pass='.$pass.'">'.$lang['add'].'</a><br/>';
print '<a href="opinion.php?act=golos&amp;id='.$id.'">'.$lang['golos'].'</a><br/>';
print $lang['que1'].'<br/>';
$q3=mysql_query("select plus, minus, ipsoft from news where id='$id'");
$r3=mysql_fetch_array($q3);
if ($r3['plus']+$r3['minus']>0) { $prplus=round(($r3['plus']/($r3['plus']+$r3['minus']))*100,2); $prminus=round(($r3['minus']/($r3['plus']+$r3['minus']))*100,2);}
else {$prplus=0; $prminus=0;}
print $lang['good'].': '.$r3['plus'].'('.$prplus.'%)<br/>'.$lang['bad'].': '.$r3['minus'].'('.$prminus.'%)<br/>';
print '---<br/>';
print $lang['showop'].' '.$count.'<br/>';
$q=mysql_query("select * from `news_com` where nid='$id' order by id desc limit ".($s*$lim).", $limit");
while($data = @mysql_fetch_array($q)){
	$date=date('h:i d ',$data['date']).' '.$lang[date('m',$data['date'])];
	print '<b>'.$data['name'].'</b>('.$date.'):<br/> '.$data['text'].'<br/>';
	print '<a href="opinion.php?pass='.$pass.'&amp;mid='.$data['id'].'&amp;act=del&amp;id='.$id.'">Del</a><br/>';
}
$razd='';
if ($s!=0) { print '<a href="opinion.php?s='.($s-1).'&amp;id='.$id.'&amp;pass='.$pass.'">'.$lang['back'].'</a>'; $razd=' | ';};
if ($count>$s*$lim+$lim) print $razd.'<a href="opinion.php?s='.($s+1).'&amp;id='.$id.'&amp;pass='.$pass.'">'.$lang['next'].'</a>';
}
print '<br/>---<br/>';
print '<a href="index.php">'.$lang['news'].'</a><br/>';
print '<a href="http://wap.waup.ru">&#169; wap.waup.ru</a><br/>';
print '</p></card></wml>';
?>