Susitvarkiau pats.

Netelpa tame langelį tekstas kur atspausdina

Pirkau :|
Tačiau sakė kad šitas scriptas nors ir prastai parašytas turi veikti.
Bet mėginau per fortume.com sukurti raktažodi crystal1 ir per test išmėginti bet raso  "Klaidingas SMS tekstas! (.)"
Tai kur galėtų būt klaida kode ar dėl netaip sukurto raktažodžio?

bet ar toks kodas gali veikti?

Esu naujokas bandantis kažką suprasti ir nenoriu iškart būt apšauktas žiopliu ir pnš.

Taigi turiu WAP žaidimą ir noriu padaryti momentinius atsiskaitymus per fortumo.com
Kodas:

<?php
$mymess = $_GET['sms']; // Gaunamas textas
$p = $_GET['amount']; //Kaina centais

$mymess = htmlspecialchars($mymess);
$mymess = str_replace("\n", "", $mymess);
$mymess = str_replace("http://", "", $mymess);
$mymess = str_replace("Http://", "", $mymess);
$mymess = str_replace("HTTP://", "", $mymess);

$sms = explode(" ", $mymess);
$tekstas = $sms[0];
$nickas = $sms[1];
$tekstas = strtolower($tekstas);

foreach(glob("player/*.txt") as $xs)
{
$xe = strtolower(str_replace(array("player/", ".txt"), "", $xs));
$xex = strtolower($nickas);

if($xe == $xex)
{
$nickas = str_replace(array("player/", ".txt"), "", $xs);
break;}
}

if($tekstas=="crystal1" && $p=="100")
{
$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+1;

$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

$ff = @file_get_contents("txt/saskaita.txt")+1;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - 1kr\n"); 
fclose($fpx);

echo "Zaidejui $nickas suteiktas 1 kristalas. (.)";
}

elseif($tekstas=="crystal2" && $p=="200")
{
$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+3;

$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

$ff = @@file_get_contents("txt/saskaita.txt")+2;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - 3kr\n"); 
fclose($fpx);

echo "Zaidejui $nickas suteikti 3 kristalai. (.)";
}

elseif($tekstas=="crystal3" && $p=="300")
{
$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+5;

$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

$ff = @file_get_contents("txt/saskaita.txt")+3;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - 5kr\n"); 
fclose($fpx);

echo "Zaidejui $nickas suteikti 5 kristalai. (.)";
}

elseif($tekstas=="crystal5" && $p=="500")
{
$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+10;

$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

$ff = @file_get_contents("txt/saskaita.txt")+5;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - 10kr\n"); 
fclose($fpx);

echo "Zaidejui $nickas suteikta 10 kristalu. (.)";
}

elseif($tekstas=="crystal10" && $p=="1000")
{
$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+25;

$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

$ff = @file_get_contents("txt/saskaita.txt")+10;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - 25kr\n"); 
fclose($fpx);

echo "Zaidejui $nickas suteikti 25 kristalai. (.)";
}

elseif($tekstas=="ordakc" && $p=="300")
{
$rand = rand(7, 13);

$ff = @file_get_contents("txt/saskaita.txt")+3;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas - akcija - $rand\n"); 
fclose($fpx);

$cr = @file_get_contents("kristalai/$nickas.txt");
if(empty($cr))
{
$cr = "0";
}
else
{
$cr = "$cr";
}
$kiek = $cr+$rand;
$fp = fopen("kristalai/$nickas.txt","w+"); 
fwrite($fp, "$kiek"); 
fclose($fp);

//echo "Akcija nebevyksta bet gavote 1 kristala kad nenueitu pinigai veltui. (old.orda2.com)";
echo "SMS gauta, jus gavote $rand kristalu. (old.orda2.com)";
}

elseif($tekstas=="ord" && $p=="100")
{
$nk = file("rkl.txt");
for($is=0; $is < count($nk); $is++) 
{
if($is == 0)
{
$nk[$is] = ""; 
$fp = fopen("rkl.txt","w"); 
fwrite($fp, implode($nk)); 
fclose($fp); 
break; 
}
}

$rkl = fopen("rkl.txt", "a");
fwrite($rkl, "$nickas\n");
fclose($rkl);

$ff = @file_get_contents("txt/saskaita.txt")+1;
$fp = fopen("txt/saskaita.txt","w+"); 
fwrite($fp, "$ff"); 
fclose($fp);

$fpx = fopen("txt/1.txt","a+"); 
fwrite($fpx, "$nickas\n"); 
fclose($fpx);

echo "Reklama ideta. (.)";
}


else
{
echo "Klaidingas SMS tekstas! (.)";
}


?>

Raktažodžiai yra:

crystal1 kaina 1lt
crystal2 kaina 2lt
crystal3 kaina 3lt
crystal5 kaina 5lt
crystal10 kaina 10lt
ordakc kaina 3lt
ord kaina 1lt

tai pirmas mano klausimas būtų ar šitas kodas yra tvarkingas?
ir kaip dabar fortumo sujungti su mano WAP žaidimu.

Lauksiu atsakymų o ne priekaištų :)
Ačiū.