Вход Регистрация
Файл: archive/www/musimka.ru/game/lugaro_game.class.php
Строк: 50
<?php

        
class lugaro_game{
    function 
__construct($lugaro){
    
$this->lugaro = $lugaro;    }

    function 
start(){
    
$this->lugaro = str_replace("",' ', $this->lugaro);
    
$this->lugaro = str_replace('../','',$this->lugaro);
    
$this->lugaro = str_replace('./','',$this->lugaro);
    
$this->lugaro = preg_replace("/[^0-9a-z/]/i", "", $this->lugaro);
    
$this->lugaro = preg_replace ("|^[/]|si",'', $this->lugaro);
    
$this->lugaro = preg_replace ("|[/]$|si",'', $this->lugaro);
    
$this->lugaro = file_exists("db_game/".$this->lugaro.".txt") ? $this->lugaro : false;
    return 
$this->lugaro;    }

    function 
no_br($str,$replace){ 
$str=preg_replace ("|[rn]+|si",$replace,$str);
return 
$str;     }

    function 
text(){
$file = file("db_game/".$this->lugaro.".txt");
$count = count($file);
$t = 0;
$l = 0;
$off = 0;
$echo['txt']='';
    for(
$i=0; $i<$count; $i++){
$txt = $this->no_br($file[$i],'');
    if(
$txt == '[TEXT]'){
$i++;
$t = 1;    }
    if(
$txt == '[ACTIONS]'){
$i++;
$t=0;
$l = 1;     }
    if(
$txt == '[IMAGE]'){
$t=0;
$l = 0;     }
    if((
$t == 1) && ($txt != '[TEXT]') && ($txt != '')){
$echo['txt'] .= $txt.'<br/>';    }


    if((
$l == 1) && ($txt != '[ACTIONS]') && ($txt != '')){
    if(
$off==0){
$link_name[] = $txt;
$off = 1;
    }else{
$off = 0;
$link[] = $txt;    }    }
    if((
$t == 0) && ($txt != '[IMAGE]') &&($l == 0) && ($txt != '')){
$echo['img'] = $txt;    }    }
$this->link = $link;
$this->link_name = $link_name;
$echo['txt'] = iconv("windows-1251", "UTF-8", $echo['txt']);
return 
$echo;    }

    function 
link(){
$count = count($this->link);
    for(
$i=0; $i<$count; $i++){
$txt = iconv("windows-1251", "UTF-8", $this->link_name[$i]);
$tx = str_replace('.txt','',$this->link[$i]);
$ext = strtolower(substr($this->link[$i], 1 + strrpos($this->link[$i], ".")));
    if(
$ext=='png'){
$txx = $this->lugaro;
    echo 
'&#187; <a href="game.php?mod='.$txx.'&amp;img='.$tx.'&amp;r='.rand(0,999).'&amp;">'.$txt.'</a><br/>';
    }else{
    echo 
'&#187; <a href="game.php?mod='.$tx.'&amp;r='.rand(0,999).'&amp;">'.$txt.'</a><br/>';
    }    }    }

    function 
xss($str){
    
$str = str_replace("",' ', $str);
    
$str = str_replace('../','',$str);
    
$str = str_replace('./','',$str);
    
$str = preg_replace("/[^0-9a-z/.]/i", "", $str);
    
$str = preg_replace ("|^[/]|si",'', $str);
    
$str = preg_replace ("|[/]$|si",'', $str);
    
$str = file_exists("db_game/".$str) ? $str : false;
    return 
$str;    }    }
?>
Онлайн: 0
Реклама