Вход Регистрация
Файл: monst/core/pag/woodh.php
Строк: 138
<?
upd_loc
('wood house');
?>
<div class='op_top_im'>
<img src='/core/i/pic/woodh.jpg' alt='' class='title_img' />
</div>
<div style='position: relative; top: -100px; color: #999; height: 0;'>
    <span style='background: #000; font-size: 20px;'><?=$lang['woodh.php']['title']?></span><br/>
    <span style='background: #000; font-size: 11px;'><?=$lang['woodh.php']['title_text']?></span><br/>
</div>

<div class='padding'>
    <div style='text-align: center; colo2r: #756861; border-top: 1px solid #999;'>
        <?=$lang['woodh.php']['desc']?><br/>
    </div>
</div>

<br/>

<?
if ( !isset($index[1]) ) {
    
$count = [];
    
$count[1] = 0;
    
$count[2] = 0;
    
$count[3] = 0;
    
$count[4] = 0;

    
$find $_woodh -> find();

    foreach ( 
$find as $f ) {
        if ( isset(
$f['user_id'] )) {
            
$count[$f['room']] += 1;
        }
    }

    
?>
    <a href='/woodh/1'><div class='bt_black'><img src='/core/i/woodh/zzz_1.png' alt='' width='20'/><?=$lang['woodh.php']['room1']?> ( <?=$count[1]?>  )</div></a>
    <a href='/woodh/2'><div class='bt_black'><img src='/core/i/woodh/zzz_2.png' alt='' width='20'/><?=$lang['woodh.php']['room2']?> ( <?=$count[2]?>  )</div></a>
    <a href='/woodh/3'><div class='bt_black'><img src='/core/i/woodh/zzz_3.png' alt='' width='20'/><?=$lang['woodh.php']['room3']?> ( <?=$count[3]?>  )</div></a>
    <a href='/woodh/4'><div class='bt_black'><img src='/core/i/woodh/zzz_4.png' alt='' width='20'/><?=$lang['woodh.php']['room4']?> ( <?=$count[4]?>  )</div></a>
    <?
} else {
    
$room = (int)$index[1];
    if ( 
$room OR $room ) {
        
g('/woodh');
    }

    
$is_sleep $_woodh -> findOne(
        [
            
'user_id' => $user['id']
        ]
    );

    if ( isset(
$_GET['sleep']) ) {

        if ( 
$is_sleep ) {
            
g('/woodh/' $room);
        }

        
$text null_html($_POST['text']);
        if ( 
mb_strlen($text'UTF-8') > 50 ) {
            
$text mb_substr($text050) . ' ..';
        }

        
$user2_id 0;

        if ( 
$room ) {
//            if ( $_POST['name'] == $user['name'] ) {
//                g('/woodh/'. $room);
//            }

            
$name = (isset($_POST['name']) ? null_html($_POST['name']) : );



            if ( 
$name ) {
                
$find $_users -> findOne(
                    [
                        
'name' => $name
                    
]
                );

                if ( 
$find ) {
                    
$user2_id $find['id'];
                    if ( 
$user2_id == $user['id'] ) {
                        
g('/woodh/'.$room.'?idiot');
                    }
                }
            }

        }


        
$id new_id('_woodh');
        
$_woodh -> insert(
            [
                
'id' => $id,
                
'user_id' => $user['id'],
                
'user2_id' => $user2_id,
                
'room' => $room,
                
'sleep_time' => time(),
                
'text' => $text,
            ]
        );

        
g('/woodh/'.$room.'?sleep_ok');
    }


    
$unsleep 1;

    if ( isset(
$_GET['unsleep']) ) {
        if ( !
$is_sleep ) {
            
g('/woodh/' $room);
        }

        
$exp 0;
        
$gold 0;
        
$silver 0;

        
$m floor(( time() - $is_sleep['sleep_time']) / 60);

        
$exp $m;
        
$silver $m;
        
$gold floor($m 60);

        if ( 
$user['vip_time'] > time() AND $is_sleep['room'] == ) {
            
$exp $exp 2;
            
$silver $silver 2;
            
$gold $gold 2;
        }


        
$_users -> update(
            [
                
'id' => $user['id']
            ],

            [
                
'$set' => [
                    
'exp' => $user['exp'] + $exp,
                    
'gold' => $user['gold'] + $gold,
                    
'silver' => $user['silver'] + $silver,
                    
'sleep_time_m' => $user['sleep_time_m'] + $m
                
]
            ]
        );

        
$_woodh -> remove(
            [
                
'user_id' => $user['id']
            ]
        );

        
$unsleep 0;

//        g('/woodh/'.$room.'?sleep_ok');

        
?>
        <div style='text-align: center;'>
            <?=$lang['woodh.php']['unsleep_text']?><br/>

            <img src='<?=$gold_icon?>' alt='' width='50'/><span class='gold_color'><?=num($gold)?></span>
            <img src='<?=$silver_icon?>' alt='' width='50'/><span class='silver_color'><?=num($silver)?></span>
            <img src='<?=$exp_icon?>' alt='' width='50'/><span class='exp_color'><?=num($exp)?></span>
        </div>

        <?
    
}

    if ( isset(
$_GET['you_sleep']) ) {
        
?>
        <div class='error_box'>
            <?=$lang['woodh.php']['you_sleep']?>
        </div>
        <?
    
}

    if ( isset(
$_GET['idiot']) ) {
        
?>
        <div class='error_box'>
            <?=$lang['woodh.php']['idiot']?>
        </div>
        <?
    
}


    if ( isset(
$_GET['sleep_ok']) ) {
        
?>
        <div class='padding'>
            <?=$lang['woodh.php']['sleep_ok']?>
        </div>
        <br/><br/>
        <?
    
}


    if ( 
$is_sleep ) {
        if ( 
$is_sleep['room'] == $room ) {
            if (
$unsleep ) {
                
?>
                <a href='/woodh/<?=$room?>?unsleep'><div class='bt_black'><?=$lang['woodh.php']['unsleep']?></div></a>
                <?
            
}
        }
    } else {
        if ( isset(
$_GET['sleep_dialog'])) {
            if ( 
$room == AND $user['vip_time'] < time() ) {
                
?>
                <div class='padding'>
                    <?=$lang['woodh.php']['no_vip']?>
                </div>
                <?
            
} else {
                
?>
                <div style='text-align: center;'>
                    <?=$lang['woodh.php']['text']?>:<br/>
                    <form method='post' action='/woodh/<?=$room?>?sleep'>
                        <input name='text' maxlength='50'/><br/>

                        <?
                        
if ( $room ) {
                            
?>
                            <?=$lang['woodh.php']['with_name']?>:<br/>
                            <input name='name'/><br/>
                            <?
                        
}
                        
?>

                        <input type='submit' value='<?=$lang['woodh.php']['go_to_sleep']?>'/>
                    </form>

                </div>
                <?

            
}

        } else {
            
?>
            <a href='/woodh/<?=$room?>?sleep_dialog'><div class='bt_black'><?=$lang['woodh.php']['go_to_sleep']?></div></a>
            <?
       
}

  
//      }
    
}
    
?>


    <br/>

        <?
        $on_page 
10;

        
$find $_woodh -> find(
            [
                
'room' => $room
            
]
        );

        
$find -> limit($on_page);

        
$find -> sort(
            [
                
'sleep_time' => -1,
            ]
        );

        
$count $find -> count();

        
$nav nav($on_page);

        
$color 0;
        if ( 
$room == $color 'steelblue';
        if ( 
$room == $color 'hotpink';
        if ( 
$room == $color 'mediumpurple';
        if ( 
$room == $color 'mediumaquamarine';


        
$i 0;
        foreach ( 
$find as $f ) {
            
$time time() - $f['sleep_time'];

            
?>
            <div style='background: #000; padding: 20px; margin-bottom: 2px;'>
                <img src='/core/i/woodh/zzz_<?=$room?>.png' alt='' width='50' style='float: left;'/>

                <a href='/id<?=$f['user_id']?>'>
                    <img src='<?=av($f['user_id'])?>' alt='' width='30' class='av' style='float: left;'/><?=Name($f['user_id'])?>
                </a>

                <?
                
if ( !empty($f['user2_id']) ) {
                    
$id2 $_woodh -> findOne(
                        [
                            
'user_id' => $f['user2_id']
                        ]
                    );

                    if ( 
$id2 AND $id2['user2_id'] == $user['id'] ) {
                        
?>
                        <span style='font-size: 20px;'>&</span>

                        <a href='/id<?=$f['user2_id']?>'>
                            <img src='<?=av($f['user2_id'])?>' alt='' width='20' class='av'/><?=Name($f['user2_id'])?>
                        </a>
                        <?
                    
}
                }
                
?>
                <br/>
                <span style='color: #777; font-size: 11px;'>
                <?=hm($time11,10)?>
            </span>
<!--                <div style='clear: both;'></div>-->

                <br/>

            <span style='color: <?=$color?>;'>
                <?=$f['text']?>
            </span>


            </div>

            <div style='clear: both;'></div>
            <?

            $i
++;
        }

        if ( !
$i ) {
            
?>
            <?=$lang['woodh.php']['empty']?><br/>
            <br/>
            <?
        
}

        print 
$nav;
        
?>

    <br/>
    <a href='/woodh'><div class='bt_black'><?=$lang['woodh.php']['back']?></div></a>
    <?
}
Онлайн: 0
Реклама