View file wap.rzz.ru/chat/prividis.php

File size: 4.35Kb
<?php
header("Content-type: text/vnd.wap.wml; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";

echo "<!-- MobiiliChat v1.07 -->\n";
echo "<!-- Copyright (C) 2004-2005 Keijo Kangas ([email protected]) -->\n";

$swe_from = array("ГҐ","Г¤","Г¶","Г…","Г„","Г–","$","&"); 
$swe_to = array("е", "д", "ц", "Е", "Д", "Ц","d","j"); 

for ($t=0; $t<count($swe_from); $t++) 
{ 
$nimi = str_replace ($swe_from[$t], $swe_to[$t], $nimi); 
$salasana = str_replace ($swe_from[$t], $swe_to[$t], $salasana);
$viesti = str_replace ($swe_from[$t], $swe_to[$t], $viesti);
$kenelle = str_replace ($swe_from[$t], $swe_to[$t], $kenelle);
} 







$l="0";
$nimet=file_get_contents('chatpaikalla.txt');
$nim=file('chatpaikalla.txt');
$salasana=crypt($salasana,'password');

$privaviestit=file('privnea.txt');
$salnim=file('nims.txt');
$salsan=file('sals.txt');
for ($i=0; $i<count($nim); $i++) 
{
$alo=explode("¤",$nim[$i]);
if ($nimi==$alo[0]){$l="1";$hee=$nim[$i];}
}

$kenelle = strtolower($kenelle);
if ($kenelle==''){$kenelle='?';}
for ($i=0; $i<count($salnim); $i++) 
{ if (rtrim($salsan[$i])==$salasana && rtrim($salnim[$i])==$nimi){$a="1";}}
if ($a !="1"){
echo "<wml>";
echo "<card title=\"Private\">";
echo "<p>";
echo "<a href=\"home.php\">[Home]</a>";
echo "</p>";
echo "</card>";
echo "</wml>";
exit();
}

$nimi= htmlspecialchars($nimi);
$viesti= htmlspecialchars($viesti);
$viesti= stripslashes($viesti);
$kenelle=stripslashes($kenelle);
$nimoni=$viesti;
$turska=file('toisto.txt');
if ($viesti !=''){

for ($l=0; $l<count($turska); $l++) 
{ if (rtrim($turska[$l])==$nimoni){$viesti='';}}

$toistoke = fopen('toisto.txt', 'r+');
$hypro=file_get_contents ('toisto.txt');  
$hape=$nimoni . '
' . $hypro;
  fputs($toistoke, $hape);
if (filesize('toisto.txt')>400)
  {ftruncate ($toistoke,400);}
fclose($toistoke);
}

echo "<wml>";
echo "<card title=\"Private ";echo date('H:i:s');echo "\" ontimer=\"prividis.php?time=";
echo date('dmHis');echo '&amp;nimi=$nimi&amp;salasana=$salasana';
echo "\">";
echo "<timer value=\"600\"/>";
echo "<p><small>";


if ($viesti !=''){
$uusirivi ='('.date('H:i:s').')'.$nimi .  '-&gt;' . $kenelle . ': ' .$viesti.'<br/>
';


  $tiedosto = fopen('privnea.txt', 'r+');
  $kolmas=file_get_contents ('privnea.txt');

  
  $toinen='*'.$kenelle.'¤'.$uusirivi . $kolmas;
  

    fputs($tiedosto, $toinen); 
    fclose($tiedosto); 
$tiedosto = fopen('privnea.txt', 'r+');
  $kolmas=file_get_contents ('privnea.txt');

  $toinen=time().'
'.$nimi.'¤'.$uusirivi.$kolmas;

  

    fputs($tiedosto, $toinen);
    fclose($tiedosto); 
}
echo "<anchor>[Write]";
echo "<go method=\"post\" href=\"privkirj.php?viesti=\">";
echo "<postfield name=\"nimi\" value=\"$(nimi)\"/>";
echo "<postfield name=\"salasana\" value=\"$(salasana)\"/>";
echo "<postfield name=\"kenelle\" value=\"$(kenelle)\"/>";
echo "<setvar name=\"viesti\" value=\"\"/>";
echo "</go>";
echo "</anchor> ";
echo "<anchor>[Chatroom]";
echo "<go method=\"post\" href=\"chat.php\">";
echo "<postfield name=\"salasana\" value=\"$(salasana)\"/>";

echo "<postfield name=\"nimi\" value=\"$(nimi)\"/>";
echo "</go>";
echo "</anchor><br/>";


$privaviestit=file('privnea.txt');

$lis=0;
for ($q=0; $q<count($privaviestit); $q++) {
$tech=explode("¤",$privaviestit[$q]);
$testos=str_replace("*", "",$tech[0]);
 if (rtrim($testos)==$nimi){
 $lis=$lis+1;if ($lis>8){$q=count($privaviestit)+1;}
$ttt=str_replace($nimi.'¤',"",$privaviestit[$q]);
 echo $ttt;
$korvaus= fopen('privnea.txt', 'r+');
$hypro=file_get_contents ('privnea.txt'); 

$testi3=$privaviestit[$q];
$testi3=str_replace("*", "", $testi3);
$hypro= str_replace($privaviestit[$q], $testi3, $hypro);
fputs($korvaus, $hypro); 
fclose($korvaus);
}
}

$joo=file('privnea.txt');
$jep=file_get_contents('privnea.txt');
$viimeinen=234430;
for ($i=0; $i<count($joo); $i++) 
{
$uusi=rtrim($joo[$i]);
settype($uusi, "integer");
if ($uusi==0){$uusi=2000000000;}
if (time()-$uusi>259200){$viimeinen=$uusi;}
}
settype($viimeinen, "string");
$pos = strpos($jep, $viimeinen);

if ($pos>0){
$toistoke = fopen('privnea.txt', 'r+');
ftruncate ($toistoke,$pos);
fclose($toistoke);}


echo "</small></p>";
echo "</card>";
echo "</wml>";
?>