Просмотр файла bestwap_news/opinion.php

Размер файла: 3.58Kb
<?
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>';
print '<head><title>BestWap.wml.su</title><LINK HREF="http://wclick.net.ru/style1.css" REL="stylesheet" TYPE="text/css"></head><body>';
print '<link rel="icon" href="http://bestwap.wml.su/favicon.png"type="image/x-icon"/>';
print '<p align="left">';
include "cfg.php";
$fl='false';
if (@$act=='add')
	if (empty($text)){
		print'Имя:<br/>
<form method="post" action="opinion.php?act=add&amp;id='.$id.'">
<input name="name" maxlength="20" value=""/><br/>
Сообщение:<br/>
<input name="text" maxlength="255" value=""/><br/>
<value="'.$id.'"/>
 <input value="Добавить" type="submit"/></form><br/>';
	} 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 ''.$lang['que'].'<br/>'."\n";
print '<p align="left" style="background-color:#666666">';
print '<a href="opinion.php?act=golos&amp;id='.$id.'&amp;op=plus">'.$lang['good'].'</a><br/>'."\n";
print '<a href="opinion.php?act=golos&amp;id='.$id.'&amp;op=minus">'.$lang['bad'].'</a><br/>'."\n";
} 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 ((empty($act))||$fl=='true'){
print '<small>';
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;
print $lang['que1'].'<br/>'."\n";
$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/>'."\n".$lang['bad'].': '.$r3['minus'].'('.$prminus.'%)<br/>'."\n";
print '<a href="opinion.php?act=golos&amp;id='.$id.'">'.$lang['golos'].'</a><br/>'."\n";
print '---<br/>';
if ((@$act!='add')&&(empty($text))) print '<a href="opinion.php?act=add&amp;id='.$id.'">'.$lang['add'].'</a><br/>'."\n";
print $lang['showop'].' '.$count.'<br/>';
print '<p align="left" style="background-color:#666666">';
$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/>'."\n";
}
$razd='';
if ($s!=0) { print '<a href="opinion.php?s='.($s-1).'&amp;id='.$id.'">'.$lang['back'].'</a>'."\n"; $razd=' | ';};
if ($count>$s*$lim+$lim) print $razd.'<a href="opinion.php?s='.($s+1).'&amp;id='.$id.'">'.$lang['next'].'</a>'."\n";
print '</small>'."\n";
}
print '<small>'."\n";
print '<p align="left">';
print '<br/>---<br/>'."\n";
print '<a href="index.php">К новостям</a><br/>'."\n";
print '<a href="http://bestwap.wml.su">bestwap.wml.su</a><br/>'."\n";
print '</p></body></html>';
?>