function random_str_a($length) {
$mas=@array(q,w,e,r,t,y,u,p,a,s,d,f,g,h,j,k,z,x,c,v,b,n,m);
for($i=0;$i<$length;$i++) {
mt_srand((double)microtime()*1000000);
$randy = mt_rand(0, sizeof($mas)-1);
@$RND .= $mas[$randy];
}
return @$RND;
}
function yes_no(){
return rand(0,1);
}
function table_var($text){
$textar = explode(" ", $text);
shuffle($textar);
$text = implode(" ", $textar);
echo $text;
}
function gen_html_start($html_block){
switch($html_block){
case 1:
$html_block_start = "<div class=\"{RANDOM_CLASS}\">";
$html_block_end = "</div>";
break;
case 2:
$html_block_start = "<div>";
$html_block_end = "</div>";
break;
case 3:
$html_block_start = "<span class=\"{RANDOM_CLASS}\">";
$html_block_end = "</span>";
break;
case 4:
$html_block_start = "<span>";
$html_block_end = "</span>";
break;
case 5:
$html_block_start = "<table width=\"100%\" class=\"{RANDOM_CLASS}\"><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 6:
$html_block_start = "<table width=\"100%\" {RANDOM_TABLE_VAR}><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 6:
$html_block_start = "<table width=\"100%\" class=\"{RANDOM_CLASS}\" {RANDOM_TABLE_VAR}><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 7:
default:
$html_block_start = "<table width=\"100%\"><tr><td>";
$html_block_end = "</td></tr></table>";
break;
}
return $html_block_start;
}
function gen_html_end($html_block){
switch($html_block){
case 1:
$html_block_start = "<div class=\"{RANDOM_CLASS}\">";
$html_block_end = "</div>";
break;
case 2:
$html_block_start = "<div>";
$html_block_end = "</div>";
break;
case 3:
$html_block_start = "<span class=\"{RANDOM_CLASS}\">";
$html_block_end = "</span>";
break;
case 4:
$html_block_start = "<span>";
$html_block_end = "</span>";
break;
case 5:
$html_block_start = "<table width=\"100%\" class=\"{RANDOM_CLASS}\"><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 6:
$html_block_start = "<table width=\"100%\" {RANDOM_TABLE_VAR}><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 6:
$html_block_start = "<table width=\"100%\" class=\"{RANDOM_CLASS}\" {RANDOM_TABLE_VAR}><tr><td>";
$html_block_end = "</td></tr></table>";
break;
case 7:
default:
$html_block_start = "<table width=\"100%\"><tr><td>";
$html_block_end = "</td></tr></table>";
break;
}
return $html_block_end;
}
function random_html_replace($text){
$random_id = random_str_a(rand(3,7));
$random_name = random_str_a(rand(3,7));
$random_class = random_str_a(rand(3,7));
$textar = explode(" ", 'width="100%" border="0" cellpadding="0" cellspacing="0" id="{RANDOM_ID}" name="{RANDOM_NAME}" class="{RANDOM_CLASS}"');
shuffle($textar);
if(yes_no()){
unset($textar['3']);
}
if(yes_no()){
unset($textar['4']);
}
if(yes_no()){
unset($textar['5']);
}
$random_table_var = implode(" ", $textar);
$text = str_replace("{RANDOM_TABLE_VAR}", $random_table_var, $text);
$text = str_replace("{RANDOM_ID}", $random_id, $text);
$text = str_replace("{RANDOM_NAME}", $random_name, $text);
$text = str_replace("{RANDOM_CLASS}", $random_class, $text);
return $text;
}
function random_html($text, $no_table){
if(!empty($no_table)){
$html_block = rand(1,4);
}else{
$html_block = rand(1,7);
}
$perevod_array = array("\n", "\r", "\t", " ");
if(yes_no()){
$perevod_str_start = $perevod_array[rand(0,sizeof($perevod_array))];
}else{
$perevod_str_start = "";
}
if(yes_no()){
$perevod_str_end = "\n";
}else{
$perevod_str_end = "";
}
if(yes_no()){
$perevod_str_text_start = "\t";
}else{
$perevod_str_text_start = "";
}
if(yes_no()){
$perevod_str_text_end = $perevod_array[rand(0,sizeof($perevod_array))];
}else{
$perevod_str_text_end = "";
}
$texts = gen_html_start($html_block).$perevod_str_start;
$texts .= $perevod_str_text_start.$text.$perevod_str_text_end;
$texts .= gen_html_end($html_block).$perevod_str_end;
echo random_html_replace($texts);
}
function random_html_start(){
global $random_html_block;
$random_html_block = rand(1,7);
$texts = gen_html_start($random_html_block);
echo random_html_replace($texts);
return $random_html_var;
}
function random_html_end(){
global $random_html_block;
$texts = gen_html_end($random_html_block);
echo random_html_replace($texts);
unset($random_html_block);
}