Просмотр файла MiniCMS/index.php

Размер файла: 13.9Kb
<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
function myErrorHandler ($errno, $errstr, $errfile, $errline) {}
set_error_handler("myErrorHandler"); 
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);
include("minicms/lang.inc.php");
include("minicms/config_bd.php");
include("minicms/config.php"); //load config
include("minicms/time.php");

///////////////////////Главная/////////////////////////////////
if ($action=="") 
{
echo "<card id=\"viewforum\" title=\"$title\">";
        echo "<p align=\"center\">";
		echo "<br/><img src=\"img/logo.gif\" alt=\"LOGO\"/><br/>";
		$text = ("wml/waps.cms"); 
        $opis = include($text); 
echo "";		
		$currHour=date("H",time());
$currDate=date("dS F, Y", time());
$curr=date("i:s", time());
$currTime=date("$currHour:i:s", time());
echo "<p align=\"center\">";
echo"<small><b>$currTime</b><br/>$currDate</small></p>";
//////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////МЕНЮ////////////////////////////////////////
$text2 = ("wml/index.cms"); 
$menu = include($text2);
echo "</p>"; 
echo "</p>";
echo "<p align=\"center\">";
echo "<small>$jangle</small><br/>";
include 'minicms/cta.php';
$text3 = ("wml/bann.cms");
 $cont = include($text3); 
 echo "<small>Версия: $ver</small><br/>";
  		echo "</p>";
        echo "</card>"; }
////////////////////////////////////////////GUEST///////////////////////////////////////////////////		
if ($action=="guest") 
{
echo "<card id=\"viewforum\" title=\"$tguest\">";
        echo "<p align=\"center\">";
echo "&#x0412;&#x044B;&#x0431;&#x0435;&#x0440;&#x0438;&#x0442;&#x0435; &#x0434;&#x0435;&#x0439;&#x0441;&#x0442;&#x0432;&#x0438;&#x0435;:
";
echo "<br/>";
echo '
<a href="index.php?action=guest_and">&#x0414;&#x043E;&#x0431;&#x0430;&#x0432;&#x0438;&#x0442;&#x044C;</a><br/>';
echo '
<a href="index.php?action=guest_read">&#x0427;&#x0438;&#x0442;&#x0430;&#x0442;&#x044C;</a><br/>';
include 'minicms/cta.php';
	echo '<br/><a href="index.php">домой</a><br/>';
	echo "<small>Версия: $ver</small><br/>";	
echo "</p>";
        echo "</card>"; }
///.......AND/././././	
if ($action=="guest_and") 
{	
echo "<card id=\"viewforum\" title=\"Добавить в $tguest\">";
echo "<p align=\"left\">";
echo '
&#x0418;&#x043C;&#x044F;:<br/>
<input type="text" name="name"/> 
<br/>
&#x0441;&#x043E;&#x043E;&#x0431;&#x0448;&#x0435;&#x043D;&#x0438;&#x0435;: <br/>
<input type="text" name="mess"/>
<br/>
E-mail:<br/> 
<input type="text" name="email"/>
<br/>

Сайт: <br/>
<input type="text" value="http://" name="sait"/>
<br/>
<anchor>Добавить
<go href="index.php?action=guest_and2" method="post">
<postfield name="name" value="$(name)"/>
<postfield name="mess" value="$(mess)"/>
<postfield name="email" value="$(email)"/>
<postfield name="sait" value="$(sait)"/>
</go>
</anchor>
<br/><br/>
<do label="Добавить" type="accept">
<go href="index.php?action=guest_and2" method="post">
<postfield name="name" value="$(name)"/>
<postfield name="mess" value="$(mess)"/>
<postfield name="email" value="$(email)"/>
<postfield name="sait" value="$(sait)"/>
</go>
</do>
';
echo "</p>";
        echo "</card>"; }

if ($action=="guest_and2") 
{
echo "<card id=\"viewforum\" title=\"Добавить в $tguest\">";
echo "<p align=\"center\">";
if (empty($name))
{
echo ' &#x0412;&#x044B; &#x043D;&#x0435; &#x0432;&#x0432;&#x0435;&#x043B;&#x0438; &#x0418;&#x043C;&#x044F;';
echo "</p>";
        echo "</card></wml>";
exit;
}
if (empty($mess))
{
echo ' &#x0412;&#x044B; &#x043D;&#x0435; &#x0432;&#x0432;&#x0435;&#x043B;&#x0438; &#x0421;&#x043E;&#x043E;&#x0431;&#x0448;&#x0435;&#x043D;&#x0438;&#x0435;';
echo "</p>";
        echo "</card></wml>";
exit;

}
$name = htmlspecialchars($name);
$mess = htmlspecialchars($mess);
$email = htmlspecialchars($email);
$sait = htmlspecialchars($sait);
$query ="INSERT INTO `guestbook` ( `date` , `name` , `message` , `email` , `sait` ) 
VALUES (
NOW(), '".$name."', '".$mess."' , '".$email."' , '".$sait."')";
if (!$query) echo 'Error '.mysql_error();
$result = mysql_query($query);
if ($result)
{
echo " &#x0421;&#x043E;&#x043E;&#x0431;&#x0448;&#x0435;&#x043D;&#x0438;&#x0435; &#x0434;&#x043E;&#x0431;&#x0430;&#x0432;&#x043B;&#x0435;&#x043D;&#x043D;&#x043E;!";
echo '<br/><a href="index.php?action=guest_read">&#x0427;&#x0438;&#x0442;&#x0430;&#x0442;&#x044C;</a>';
echo "</p>";
        echo "</card></wml>";
exit;
}
else
{
echo "Error!<br/>";
echo mysql_error();
}
echo "</p>";
        echo "</card>"; }	
		
	
///.....ЧИТАТЬ GB/././
if ($action=="guest_read") 
{
echo "<card id=\"viewforum\" title=\"Читать $tguest\">";
echo "<p align=\"center\">";
if (empty($page)) $page = 0;
if ($page < 0) $page = 0;
$count_query = 'select count(*) from `guestbook` where 1 ;';
$total_mess = mysql_query ($count_query);
$total_count = mysql_fetch_array ($total_mess);
$count = $total_count ['count(*)'];

if ($count == 0)
{
print ('Извените но в гостевой книге нет сообщений').'<br/>';
echo '<a href="index.php?action=guest">назад</a><br/>';
exit;
}
print ('Всего сообщений: ').$count.'<br/>';
$currHour=date("H",time());
$currDate=date("dS F, Y", time());
$curr=date("i:s", time());
$currTime=date("$currHour:i:s", time());
echo "<p align=\"center\">";
echo"<small><b>$currTime</b><br/>$currDate</small></p>";
echo "</p>
<p>"; 
  echo "<br/>";
echo '
<a href="index.php?action=guest_and">&#x0414;&#x043E;&#x0431;&#x0430;&#x0432;&#x0438;&#x0442;&#x044C;</a><br/>';

$query = "SELECT * FROM `guestbook` ORDER BY `date` DESC LIMIT ".$page." , ".$max_mess.";"; 
if (!$query) echo mysql_error();
$result = mysql_query($query);
if (!$result) echo mysql_error();
while($otvet = mysql_fetch_array($result)) 
  { 

	print '........<br/>';
    print_r(('Дата: ').$id = $otvet ['date']); 
	print '<br/>';
    
	print '<img src="stl/prof.gif" alt="NAME"/>'.($id = $otvet ['name']).'';
	print_r((':<i> ').($id = $otvet ['message']).'</i><br/>'); 

if($id = $otvet ['email']!=""){print" e-mail: <a href=\"mailto:".($id = $otvet ['email'])."\">".($id = $otvet ['email'])."</a>";}
if($id = $otvet ['sait']!="") {print"<br/> Сайт: <a href=\"".($id = $otvet ['sait'])."\">".($id = $otvet ['sait'])."</a>";}
if($id = $otvet ['otvet']!=""){print"<br/><small>Админ: ".($id = $otvet ['otvet'])."</small>";}

		print '<br/>........';
	
	  } 
echo "<br/>";
echo '
<a href="index.php?action=guest_and">&#x0414;&#x043E;&#x0431;&#x0430;&#x0432;&#x0438;&#x0442;&#x044C;</a><br/>';
echo "</p>";
echo "<p align=\"center\">"; 

if ($page > 0)  echo '<a href="index.php?action=guest_read&amp;page='.($page - $max_mess).'">&#x041F;&#x0440;&#x0435;&#x0434;&#x044B;&#x0434;&#x0443;&#x0449;&#x0438;&#x0435;</a> ';
  if ($count > $page + $max_mess)  echo ' <a href="index.php?action=guest_read&amp;page='.($page + $max_mess).'">&#x0421;&#x043B;&#x0435;&#x0434;&#x0443;&#x044E;&#x0449;&#x0438;&#x0435;</a>';
include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';
echo "</p>";
        echo "</card>"; }
//////////////////////////////////////////////////////////////////////////////////////////////////////
if ($action=="news") {
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";
if (!@$s) $s=0;
$q=mysql_query("select count(id) from `news` where 1;");
$r=mysql_fetch_array($q);
$count=$r['count(id)'];
if ($s*$lim+$lim>$count) $limit=$count-$s*$lim; else $limit=$lim;
//print $s*$lim;
print $lang['show'].($s*$lim+1).'-'.($s*$lim+$limit).'<br/>'."\n";
$q=mysql_query("select * from `news` where 1 order by id desc limit ".($s*$lim).", $limit");
while($data = @mysql_fetch_array($q)){
	$date = (int)(date('d',$data['date'])).' '.$lang[date('m',$data['date'])];
	print '<b><u>'.$date.'</u></b><br/>'.$data['text'].'<br/>'."\n";
	$r1=mysql_fetch_array(mysql_query("select count(*) from `news_com` where nid='".$data['id']."';"));
	print '<a href="index.php?action=news_kom&amp;id='.$data['id'].'">'.$lang['opinion'].'</a> ['.$r1['count(*)'].']<br/><br/>'."\n";
}


if ($s!=0)  echo '<a href="index.php?action=news&amp;s='.($s-1).'">&#x041F;&#x0440;&#x0435;&#x0434;&#x044B;&#x0434;&#x0443;&#x0449;&#x0438;&#x0435;</a> ';
if ($count>$s*$lim+$lim)  echo ' <a href="index.php?action=news&amp;s='.($s+1).'">&#x0421;&#x043B;&#x0435;&#x0434;&#x0443;&#x044E;&#x0449;&#x0438;&#x0435;</a><br/>';
echo "<br/><br/><small>Версия: $ver</small><br/>";  
echo '<a href="index.php">домой</a><br/>';

echo "</p>";

        echo "</card>"; }
///////////////////////NEWSкоментарии		
if ($action=="news_kom") {
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";
$fl='false';


{
$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="index.php?action=news_andkom&amp;id='.$id.'">'.$lang['add'].'</a><br/>';
print '<a href="index.php?action=news_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 '.......<br/>';
}
if ($s!=0)  echo '<a href="index.php?action=news_kom&amp;s='.($s-1).'">&#x041F;&#x0440;&#x0435;&#x0434;&#x044B;&#x0434;&#x0443;&#x0449;&#x0438;&#x0435;</a> ';
if ($count>$s*$lim+$lim)  echo ' <a href="index.php?action=news_kom&amp;s='.($s+1).'">&#x0421;&#x043B;&#x0435;&#x0434;&#x0443;&#x044E;&#x0449;&#x0438;&#x0435;</a>';
}	
include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';
echo "</p>";
        echo "</card>"; }	
///////////////////ANDком		
if ($action=="news_andkom") {
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";	
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="index.php?action=news_andkom2&amp;id='.$id.'" method="post">
		<postfield name="name" value="$(name)"/>
		<postfield name="text" value="$(text)"/>
		<postfield name="id" value="'.$id.'"/>
		</go></anchor>';
	include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';	
echo "</p>";
        echo "</card>"; }	
///////////////////ANDком2		
if ($action=="news_andkom2") {
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";
        $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';
		echo 'Комментарий добавлен';
	include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';	
echo "</p>";
        echo "</card>"; }
/////NEWS Голос		
if ($action=="news_golos") {
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";
print '<b>'.$lang['que'].'</b><br/>';
print '<a href="index.php?action=news_andgolos&amp;id='.$id.'&amp;op=plus">'.$lang['good'].'</a><br/>';
print '<a href="index.php?action=news_andgolos&amp;id='.$id.'&amp;op=minus">'.$lang['bad'].'</a><br/>';
include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';	
echo "</p>";
        echo "</card>"; }							
//////////////////////////////////////////////////////////////////////////////////////////////////////
	/////NEWS Голос		
if ($action=="news_andgolos") {	
echo "<card id=\"viewforum\" title=\"$nguest\">";
echo "<p align=\"center\">";
$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;
echo 'Ваш Голос Учтен!';
include 'minicms/cta.php';
echo '<br/><a href="index.php">домой</a><br/>';	
echo "</p>";
        echo "</card>"; }			
?>
</wml>