Soloution
anderson wrote:
hello,
Sometimes I face this problem in my WML site that when someone does a mistake in bbcode sequence in shoutbox the homepage then doesnt open. as example sometimes they apply like this:
[b ][i ] [u ]some text[/u ][/b ][/i ]
but it should be:
[b ][i ] [u ]some text[/u ][/i ][/b ]
As a result users having WAP 1.0 browser arent able to enter homepage. Whenever the shout is deleted they can come.
If anyone has its solution sothat after applying errors the page still can open plz share here.
I havent tested this and there is probably a better way to code this but heres a code iv made to stop it
$bbcheck=preg_replace("/\[b\](.*?)\[\/b\]/i","b1b2", $text);
$bbcheck=preg_replace("/\[i\](.*?)\[\/i\]/i","i1i2", $bbcheck);
$bbcheck=preg_replace("/\[u\](.*?)\[\/u\]/i","u1u2", $bbcheck);
$bbcheck=preg_replace("/\[big\](.*?)\[\/big\]/i","big1big2", $bbcheck);
$bbcheck=preg_replace("/\[small\](.*?)\[\/small\]/i","small1small2", $bbcheck);
$testa = array("b1","i1","u1","big1","small1");
$checka = substr_count($bbcheck,$testa);
$testb = array("b2","i2","u2","big2","small2");
$checkb = substr_count($bbcheck,$testb);
if($checka!=$checkb){
$text = "BB Code Error";
}
$bbcheck=preg_replace("/\[i\](.*?)\[\/i\]/i","i1i2", $text);
$bbcheck=preg_replace("/\[b\](.*?)\[\/b\]/i","b1b2", $bbcheck);
$bbcheck=preg_replace("/\[u\](.*?)\[\/u\]/i","u1u2", $bbcheck);
$bbcheck=preg_replace("/\[big\](.*?)\[\/big\]/i","big1big2", $bbcheck);
$bbcheck=preg_replace("/\[small\](.*?)\[\/small\]/i","small1small2", $bbcheck);
$testa = array("b1","i1","u1","big1","small1");
$checka = substr_count($bbcheck,$testa);
$testb = array("b2","i2","u2","big2","small2");
$checkb = substr_count($bbcheck,$testb);
if($checka!=$checkb){
$text = "BB Code Error";
}
$bbcheck=preg_replace("/\[u\](.*?)\[\/u\]/i","u1u2", $text);
$bbcheck=preg_replace("/\[i\](.*?)\[\/i\]/i","i1i2", $bbcheck);
$bbcheck=preg_replace("/\[b\](.*?)\[\/b\]/i","b1b2", $bbcheck);
$bbcheck=preg_replace("/\[big\](.*?)\[\/big\]/i","big1big2", $bbcheck);
$bbcheck=preg_replace("/\[small\](.*?)\[\/small\]/i","small1small2", $bbcheck);
$testa = array("b1","i1","u1","big1","small1");
$checka = substr_count($bbcheck,$testa);
$testb = array("b2","i2","u2","big2","small2");
$checkb = substr_count($bbcheck,$testb);
if($checka!=$checkb){
$text = "BB Code Error";
}
$bbcheck=preg_replace("/\[big\](.*?)\[\/big\]/i","big1big2", $text);
$bbcheck=preg_replace("/\[u\](.*?)\[\/u\]/i","u1u2", $bbcheck);
$bbcheck=preg_replace("/\[i\](.*?)\[\/i\]/i","i1i2", $bbcheck);
$bbcheck=preg_replace("/\[b\](.*?)\[\/b\]/i","b1b2", $bbcheck);
$bbcheck=preg_replace("/\[small\](.*?)\[\/small\]/i","small1small2", $bbcheck);
$testa = array("b1","i1","u1","big1","small1");
$checka = substr_count($bbcheck,$testa);
$testb = array("b2","i2","u2","big2","small2");
$checkb = substr_count($bbcheck,$testb);
if($checka!=$checkb){
$text = "BB Code Error";
}
$bbcheck=preg_replace("/\[small\](.*?)\[\/small\]/i","small1small2", $text);
$bbcheck=preg_replace("/\[big\](.*?)\[\/big\]/i","big1big2", $bbcheck);
$bbcheck=preg_replace("/\[u\](.*?)\[\/u\]/i","u1u2", $bbcheck);
$bbcheck=preg_replace("/\[i\](.*?)\[\/i\]/i","i1i2", $bbcheck);
$bbcheck=preg_replace("/\[b\](.*?)\[\/b\]/i","b1b2", $bbcheck);
$testa = array("b1","i1","u1","big1","small1");
$checka = substr_count($bbcheck,$testa);
$testb = array("b2","i2","u2","big2","small2");
$checkb = substr_count($bbcheck,$testb);
if($checka!=$checkb){
$text = "BB Code Error";
}
hope this helps 8)