...

View Full Version : WAP Chat script error, please help!



procore
10-31-2006, 07:37 PM
hi guys,

i wrote a chat script some time ago on my old server, it was working fine and everything. i canceled my hosting later on, a few months passed and i got a new host, so i uploaded my chat and everything worked fine except my private, which is used at prividis.php

this is a server problem and i dont know how to fix the code so that it can work again.

its a flatfile php script used for WAP (mobile phones) but can be accesed from opera, mozzila etc..

this is the prividis.php code



<?php
header("Content-type: text/vnd.wap.wml");
header("display_errors=0");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"
\"http://www.wapforum.org/DTD/wml_1.1.xml\">";
echo "<!-- procore@waprave.net -->\n";


$swe_from = array("","","","","","","$","&");
$swe_to = array("", "", "", "", "", "","[usd]","[and]");

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');
$privanimet=file('privnims.txt');
$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 "You are not logged in! please hit the 'Back' button and login again";
echo "<br/>Sorry for the invonvinience...<br/>";
echo "<a href=\"index.php\">Back</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 "\" ontimer=\"prividis.php?time=";
echo date('dmHis');echo '&amp;nimi=$nimi&amp;salasana=$salasana';
echo "\">";
echo "<timer value=\"200\"/>";
echo "<p><small>";


$name= htmlspecialchars($nimi);
$name= stripslashes($nimi);
$message= htmlspecialchars($viesti);
$message=stripslashes($viesti);
include("smileyarray.php");
$kuv=file('smileywml.txt');
for ($m=0; $m<count($joo); $m++)

{
$viesti = str_replace ($joo[$m], rtrim($kuv[$m]), $viesti);
}
$joo='';

$rumatsanat=file('sensuuri.txt');
for ($ri=0; $ri<count($rumatsanat); $ri++)
{
$vaihto=rtrim($rumatsanat[$ri]);
$viesti = str_replace ($vaihto,"@spam@", $viesti);
}

$user = explode ('/', $HTTP_USER_AGENT);
$ip = ($REMOTE_ADDR);

if ($viesti !=''){
if($admin=="4"){$uusirivi ='<a href="pm.php?kenelle='.$nimi.'&amp;nimi=$nimi&amp;salasana=$salasana">'.$nimi.'</a> >> <a href="pm.php?kenelle='.$kenelle.'&amp;nimi=$nimi&amp;salasana=$salasana">'.$kenelle.'</a> <br/>
';}else{$uusirivi ='<a href="pm.php?kenelle='.$nimi.'&amp;nimi=$nimi&amp;salasana=$salasana">'.$nimi.'</a> >> <a href="pm.php?kenelle='.$kenelle.'&amp;nimi=$nimi&amp;salasana=$salasana">'.$kenelle.'</a>: '.$viesti.'<br/>
';}



$tiedosto = fopen('privnea.txt', 'r+');
$kolmas=file_get_contents ('privnea.txt');
$tiedosto3 = fopen('privnims.txt', 'r+');
$kolmas3=file_get_contents ('privnims.txt');
$toinen='*'.$kenelle.''.$uusirivi . $kolmas;
$toinen3=$kenelle . '
'. $kolmas3;

fputs($tiedosto, $toinen); fputs($tiedosto3, $toinen3);
fclose($tiedosto); fclose($tiedosto3);
$tiedosto = fopen('privnea.txt', 'r+');
$kolmas=file_get_contents ('privnea.txt');
$tiedosto4 = fopen('privnims.txt', 'r+');
$kolmas4=file_get_contents ('privnims.txt');

$toinen=$nimi.''.$uusirivi.$kolmas; $toinen4=$nimi .'
'.$kolmas4;

fputs($tiedosto, $toinen);fputs($tiedosto4, $toinen4);
fclose($tiedosto); fclose($tiedosto4);
}

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>";
echo "<anchor>Refresh";
echo "<go method=\"post\" href=\"prividis.php\">";
echo "<postfield name=\"salasana\" value=\"$(salasana)\"/>";
echo "<postfield name=\"nimi\" value=\"$(nimi)\"/>";
echo "</go>";
echo "</anchor>\n";
echo "<br/>";

$privanimet=file('privnims.txt');
$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>10){$q=count($privaviestit)+1;}
$this=str_replace($nimi.'', "",$privaviestit[$q]);
echo $this;
$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);
}
}
include("smileyarray.php");
$kuv=file('smileywml.txt');


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>";echo "<br/>";
echo "</small></p>";
echo "</card>";
echo "</wml>";
?>



when i try to access prividis.php from my chat using opera browser i only get a blank page, i also tried validating the page but it says "The Document `http://chat.waprave.net/prividis.php` could not load!"

here is the validating link
http://www.validome.org/validate/?uri=http://chat.waprave.net/prividis.php&lang=en&doctype=
doctypeAUTO&charset=charsetAUTO

the link to the chatroom is http://chat.waprave.net


IF ANYONE CAN PLEASE HELP ME, HELP ME ASAP!!!!!

procore
10-31-2006, 07:39 PM
If you need to see the complete script please download it from http://waprave.net/noChat.zip

GUYS PLEASE IM DESPERATE FOR THIS TO BE FIXED, ive tried everything but no luck :( :(

procore
11-01-2006, 05:05 PM
Please Help Pls Pls Pls

tariqstone
11-15-2006, 08:30 PM
Hi bro !!
I have chkd all codes .
all working fine but there is little problem with some files.
remove line from files with content ::
header("display_errors=0");
when I download this scripts , it was not working but after removing this from some files , working fine, and thnx a lot , this is nice chat room which I really need , but I need help if u help me, my ID is tariqstone@hotmail.com
ok BYE n enjoy.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum