';
// ***************************************voit*************************************************************
$aa=str_replace('.php','',$a); //
$aa=str_replace('/gidra/pages/','',$aa); //
$rep="";
if (file_exists('../otd/1251'))
{$utf8=0;} else {$utf8=1;} //
if (isset ($_REQUEST['V']) or isset ($_REQUEST['VR']) )
{$tf='/tv/'.trim($_REQUEST['file']). '.htm'; //
$ifg = wu(getcwd ( ).'/'.$aa.$tf,$utf8); //
if (file_exists($ifg)) //
{$ip=trim($_SERVER["REMOTE_ADDR"]); //
$tf1='/tv/'.trim($_REQUEST['file']). '.txt'; //
$ifg1 = wu(getcwd ( ).'/'.$aa.$tf1,$utf8);
if (file_exists($ifg1))
{}
else
{$rw=file_put_contents($ifg1,'/'); //
}
$sip= trim(file_get_contents($ifg1)); //
if (strpos(" ".$sip,'/'.$ip.'/')>0) //
{$da=false;
}
else //
{$len=2000; //
if (strlen($sip)>$len) //
{$sip=substr($sip,0,$len);
}
$rw=file_put_contents($ifg1,'/'.$ip.$sip); //
$da=true;
}
if ($da)
{$l = file($ifg); //
$k=0; //
$s=0; //
$sk=1;
$arr=array();
foreach ($l as $li => $lin) //
{if (trim($lin)=='' or trim($lin)=='' ) //
{ $arr[++$li]=trim($l[$li]);
++$k; }
}
foreach ($_REQUEST as $i => $z) //
{if (is_numeric ($i)) //
{
$kk=1; //
$kkt=1; //
foreach ($arr as $ii => $iin) //
{if ($kk==4) {$kk=1;++$kkt;}
if ($kkt==$z)
{if ($kk==1) {$arr[$ii]=$arr[$ii]+1;} //
}
++$kk;
}}}
//
$su=0; //
$kk=1; //
foreach ($arr as $ii => $iin) //
{if ($kk==4) {$kk=1;}
if ($kk++==1) {$su=$su+$iin;} //
}
$rep1="";
if ($su==0)
{$rep1= 'You did not vote! There was no choice.';
}
else
{$kk=1; //
$sp=0; //
foreach ($arr as $ii => $iin) //
{if ($kk==4) {$kk=1;}
if ($kk==1) //
{$zn=$iin;
}
if ($kk==2) // %
{$arr[$ii]=round((100/$su)*$zn);
$sp=$sp+$arr[$ii];
if ($sp>100) {$d=$sp-100; if ($arr[$ii]>0) { $arr[$ii]=$arr[$ii]-$d;}}
$kur=$arr[$ii]/2; //
}
if ($kk==3) //
{$arr[$ii]=str_repeat(" ", $kur);
}
++$kk;
}
$w =fopen($ifg, 'w') or exit; //
foreach ($l as $li => $lin) //
{if (array_key_exists ( $li,$arr)) //
{fwrite($w,$arr[$li]."\r\n");
}
else
{fwrite($w,$lin);
}}
fclose($w);
}}
if ($rep1=="")
{echo 'Thanks for voting! Your vote has been counted.';
}
else
{echo $rep1;
}}
else
{echo 'No voting file! Contact the developer.';
}}
//***************************************** ************************************************
//$rep=""; //
$tf=""; //
$tt=""; //
if (isset ($_REQUEST['Q']))
{
echo 'Your question is accepted! The answer will be given soon.';
$rep="1";
//$rep="
";
$tf='/tq/tq.txt'; //
$tt='question';
$tt1='Questions and Answers';
}
if (isset ($_REQUEST['C']))
{
echo 'Your comment is accepted! It will be inserted on the page after moderation.';
$rep="2";
$tf='/tc/tc.txt'; //
$tt='Comment';
$tt1='Comments';
}
if (isset ($_REQUEST['G']))
{
echo 'Your entry has been accepted! It will be published in the guest after moderation.';
$rep="4";
//$rep="
$tf='/tg/tg.txt'; //
$tt=' Guestbook';
$tt1=' Guestbook2';
}
$pub="-";
//
if (isset ($_REQUEST['QN']))
{
echo 'Your question has been posted! The answer will be given soon.';
$rep="5";
//$rep=
$tf='/tq/tq.txt'; //
$tt='question';
$tt1='Questions and Answers';
$pub="+";
}
if (isset ($_REQUEST['CN']))
{
echo 'Your comment has been published!';
$rep="6";
//$rep='
$tf='/tc/tc.txt'; //
$tt='Comment';
$tt1='Comments';
$pub="+";
}
if (isset ($_REQUEST['GN']))
{
echo 'Your entry has been posted!';
$rep="8";
//$rep='
$tf='/tg/tg.txt'; //
$tt=' Guestbook';
$tt1=' Guestbook2';
$pub="+";
}
if ($rep!="") //
{
$fg = wu(getcwd ( ).'/'.$aa.$tf,$utf8); //
//echo getcwd ( );
if (file_exists($fg))
{
$l = file($fg); //
if (isset ($_REQUEST['img']))
{$img=trim($_REQUEST['img']);} else {$img="";}
if ($img=="")
{$img="s1.gif";}
$text=trim(stripslashes ($_REQUEST['text'])); //
$name=trim(stripslashes ($_REQUEST['name'])); //
$text=htmlspecialchars($text, ENT_QUOTES,"cp1251"); //
$name=htmlspecialchars($name, ENT_QUOTES,"cp1251"); //
$text=str_replace("\r\n"," ",$text); //
$name=str_replace("\r\n"," ",$name); //
$name=str_replace('//'," ",$name);
$text=str_replace('//'," ",$text);
if ($text=="" or $name=="")
{
echo 'Your comment has been published!';
//echo
}
else
{
if ($tt1=='Questions and Answers') //
{$str=$_SERVER["REMOTE_ADDR"].'//'.$img.'//'.$name.'//'.date("d-m-Y").'//'.$text.
'//Moderator//Wait for an answer!//'.$pub."\r\n";}
else
{$str=$_SERVER["REMOTE_ADDR"].'//'.$img.'//'.$name.'//'.date("d-m-Y").'//'.$text.'//'.$pub."\r\n";}
$w =fopen($fg, 'w') or exit; //
fwrite($w,$str); //
foreach ($l as $li => $lin) //
{
fwrite($w,$lin);
}
fclose($w);
//*******************************************************************************************************************
if ($pub=="+") //
//*******************************************************************************************************************
{
if ($tt1=='Questions and Answers')
{
$fhtml=wu(getcwd().'/'.$aa.'/tq/tq.htm',$utf8); //
$wh=fopen($fhtml, 'w') or exit; //
$l = file($fg); //
//
fwrite($wh,'
Questions and Answers
');
$ii=1; //
//
foreach ($l as $li => $lin) //
{
if (substr($lin,0,1)!="*") //
{
list($ip,$ka,$im,$d,$t,$ab,$ot,$p)=explode("//",$lin);
if (trim($p)=="+") //
{
$ww='
'.$ii++.'
'.
'
'.trim($d).'
'.
'
'.trim($im).', QUESTION:
'.
'
'.trim($t).'
'.
'
'.$ab.', ANSWERS:
'.
'
'.$ot.'
';
fwrite($wh,$ww);
}
}
}
fwrite($wh,"
");
fclose($wh); //
}
//******************************
if ($tt1=='Comments')
{
$fhtml=getcwd().'/'.$aa.'/tc/tc.htm'; // html
$wh=fopen($fhtml, 'w') or exit; // html
$l = file($fg); //
fwrite($wh,'
Comments
');
$ii=1; //
//
foreach ($l as $li => $lin) //
{
if (substr($lin,0,1)!="*") //
{
list($ip,$ka,$im,$d,$t,$p)=explode('//',$l[$li]);
if (trim($p)=="+") //
{
$ww='
'.trim($ii++).'
'.$d.'
'.$im. '
'.str_replace(' ',' ',$t)."
";
fwrite($wh,$ww);
}}}
fwrite($wh,"
");
fclose($wh); //
}
//***************************
if ($tt1==' Guestbook2')
{
$fhtml=wu(getcwd().'/'.$aa.'/tg/tg.htm',$utf8); // html
$wh=fopen($fhtml, 'w') or exit; // html
$l = file($fg); // txt
fwrite($wh,'
Guest book
');
$ii=1; //
//
foreach ($l as $li => $lin) //
{
if (substr($lin,0,1)!="*") //
{
list($ip,$ka,$im,$d,$t,$p)=explode("//",$l[$li]);
if (trim($p)=="+") //
{
$ww='
'.trim($ii++).'
'.$d.'
'.$im. '
'.str_replace(' ',' ',$t)."
";
fwrite($wh,$ww);
}
}}
fwrite($wh,"
");
fclose($wh); //
}
//****************************
}
//echo $rep;
}
}
else
{
echo "Mistake ! Missing file ".$tf." Put on page ". $tt1." and repeat.";
}
}
?>