!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/msdp.undp.org.ua/modules/comments/   drwxr-xr-x
Free 106.8 GB of 200.55 GB (53.25%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     module.php (10.94 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
class Comments
{
    var 
$UserMode   true;
    var 
$UserAsynchMode   true;
    var 
$AdminMode  false;
    var 
$SearchMode false;
    var 
$PanelMode  false;
    var 
$AdminAsynchMode false;
    var 
$Table;
    var 
$ClassName 'Comments';
    var 
$Directory;
    function 
__construct()
    {
        
$this->Directory dirname(__FILE__);
        
$this->Table = new AMTable2('AMCMS_comments');
        
$this->Table->Module($this->ClassName);
        
$this->Table->AddIndexField("comment_id");
    }
    static function 
GetCommentsCount($module$chapter$page)
    {
        
$sql "SELECT COUNT(*) as count FROM AMCMS_comments as c WHERE c.comment_module = '{$module}' AND c.comment_chapter = '{$chapter}' AND c.comment_page = '{$page}' AND c.comment_status != '0'";
        
$res mysql_query($sql);                
        
$row mysql_fetch_assoc($res);
        return 
$row['count'];
    }
    static function 
GetLastComment($module$chapter$page)
    {
        
$sql "SELECT * FROM AMCMS_comments as c WHERE c.comment_module = '{$module}' AND c.comment_chapter = '{$chapter}' AND c.comment_page = '{$page}' AND c.comment_status != '0' ORDER BY comment_id DESC";
        
$res mysql_query($sql);                
        
$row mysql_fetch_assoc($res);
        return 
$row;
    }
    static function 
GetNewCommentBlock($module$chapter$page)
    {
        global 
$ULANG$ulang;
        
$smarty GetUserSmarty("Comments");
        
$smarty->assign('mod'"Comments");
        
$smarty->assign('module',     $module);
        
$smarty->assign('chapter',     $chapter);
        
$smarty->assign('page',     $page);
        return 
$smarty->fetch("comment-new.tpl");
    }
    static function 
GetInfoAboutComment($comment_id)
    {
        
$sql "SELECT (SELECT COUNT(*) FROM `AMCMS_comments_votes` WHERE vote_comment_id = '{$comment_id}') as count, (SELECT COUNT(*) FROM `AMCMS_comments_votes` WHERE vote_comment_id = '{$comment_id}' AND vote_points = '-1') as minus, (SELECT COUNT(*) FROM `AMCMS_comments_votes` WHERE vote_comment_id = '{$comment_id}' AND vote_points = '+1') as plus, (SELECT SUM(vote_points) FROM `AMCMS_comments_votes` WHERE vote_comment_id = '{$comment_id}') as sum";
        
$res mysql_query($sql);
        
$row mysql_fetch_assoc($res);
        if (
$row['sum'] == 0)
            
$row['sum'] = 0;
        return 
$row;
    }
    static function 
GetComments($module$chapter$page, &$navigator null, &$navigatorObject null)
    {
        global 
$ULANG$ulang;
        
$smarty GetUserSmarty("Comments");
        
$smarty->assign('mod'"Comments");
        
$smarty->assign('module',     $module);
        
$smarty->assign('chapter',     $chapter);
        
$smarty->assign('page',     $page);

        
$sql "SELECT COUNT(*) as count FROM AMCMS_comments as c WHERE c.comment_module = '{$module}' AND c.comment_chapter = '{$chapter}' AND 
c.comment_page = '
{$page}' AND c.comment_status != '0'";
        
$countRow mysql_fetch_assoc(mysql_query($sql));

        
$page_navigator = new AMPageNavigator($countRow['count'], $_GET['pageNum'], 20);    
        
$limit $page_navigator->GetLimitStatement();

        
$sql "SELECT c.*, u.*, pu.user_name as p_user_name, pu.user_surname as p_user_surname, pc.comment_id as p_comment_id, pc.comment_date as p_comment_date FROM AMCMS_comments as c LEFT JOIN AMCMS_users as u ON c.comment_user_id = u.user_id LEFT JOIN AMCMS_comments as pc ON c.comment_parent_id = pc.comment_id LEFT JOIN AMCMS_users as pu ON pc.comment_user_id = pu.user_id WHERE c.comment_module = '{$module}' AND c.comment_chapter = '{$chapter}' AND 
c.comment_page = '
{$page}' AND c.comment_status != '0' ORDER BY c.comment_date ASC $limit";
        
$res mysql_query($sql);        
        
$rows = array();
        
$i 1;
        
$numbers = array();
        while (
$row mysql_fetch_assoc($res))
        {
            
Users::isonline($row);
            
$numbers[$row['comment_id']] = $page_navigator->GetStartIndex() + $i;
            
$row['number'] = $page_navigator->GetStartIndex() + $i;
//            if ($_SESSION['user_id'] == 2)
            
$row['comment_text'] = ReplaceImages($row['comment_text']);
            
$row['comment_text'] = ReplaceLinks($row['comment_text']);
            
$par Comments::GetInfoAboutComment($row['comment_id']);
            
$user_id $_SESSION['user']['user_id'];
            
$comment_id $row['comment_id'];
            
$sql1 "SELECT * FROM AMCMS_comments_votes WHERE vote_user_id = '{$user_id}' AND vote_comment_id = '{$comment_id}'";
            
$res1 mysql_query($sql1);
            
$row1 mysql_fetch_assoc($res1);            
            if (
$par['sum'] > 0)
                
$par['sum'] = "+".$par['sum'];
            if (
$row1['vote_points'] == -1)
                
$par['disabled']['dec'] = ' disabled';
            if (
$row1['vote_points'] == 1)
                
$par['disabled']['inc'] = ' disabled';
            
$row array_merge($row$par);
            
$rows[] = $row;
            
$i++;
        }
        
$smarty->assign("numbers"$numbers);
        
$smarty->assign("rows"$rows);
        
$navigatorObject $page_navigator;
        
$navigator $page_navigator->GetNavigator();
        
$smarty->assign("navigator"$navigator);
        return 
$smarty->fetch("comments.tpl");
    }
    
    function 
UserAsynch()
    {
        global 
$ULANG$ulang;
        if (isset(
$_REQUEST['module']))
        {
            @include(
"user/languages/".strtolower($_REQUEST['module'])."-r-{$ulang}.php");
        }
        if (!isset(
$_SESSION['user']['user_id']))
            return;
        if (
$_POST['oper'] == 'plus')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;            
            
$user_id $_SESSION['user']['user_id'];
            
$comment_id $_POST['id'];
            
$points "+1";
            
$sql "SELECT * FROM AMCMS_comments_votes WHERE vote_user_id = '{$user_id}' AND vote_comment_id = '{$comment_id}'";
            
$res mysql_query($sql);
            
$row mysql_fetch_assoc($res);
            if (
$row && $row['vote_points'] == -1)
                
mysql_query("DELETE FROM AMCMS_comments_votes WHERE vote_user_id = '{$user_id}' AND vote_comment_id = '{$comment_id}'");
            else 
                
$block "inc";
            if (!
$row)
            {
                
$sql "INSERT INTO AMCMS_comments_votes (vote_user_id, vote_comment_id, vote_points) VALUES ('{$user_id}', '{$comment_id}', '{$points}')";
                
mysql_query($sql);
                
$block "inc";
            }
            
$rez Comments::GetInfoAboutComment($comment_id);
            
$rez['block'] = $block;
            echo 
json_encode($rez);
            die;
        }
        if (
$_POST['oper'] == 'minus')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;                    
            
$user_id $_SESSION['user']['user_id'];
            
$comment_id $_POST['id'];
            
$points "-1";
            
$sql "SELECT * FROM AMCMS_comments_votes WHERE vote_user_id = '{$user_id}' AND vote_comment_id = '{$comment_id}'";
            
$res mysql_query($sql);
            
$row mysql_fetch_assoc($res);
            if (
$row && $row['vote_points'] == 1)
                
mysql_query("DELETE FROM AMCMS_comments_votes WHERE vote_user_id = '{$user_id}' AND vote_comment_id = '{$comment_id}'");
            else 
                
$block "dec";
            if (!
$row)
            {
                
$sql "INSERT INTO AMCMS_comments_votes (vote_user_id, vote_comment_id, vote_points) VALUES ('{$user_id}', '{$comment_id}', '{$points}')";
                
mysql_query($sql);
                
$block "dec";
            }
            
$rez Comments::GetInfoAboutComment($comment_id);
            
$rez['block'] = $block;
            echo 
json_encode($rez);            
            die;
        }        
        if (
$_POST['oper'] == 'newcomment')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;                        
               
$comment_text str_replace("  ""&nbsp; "htmlspecialchars($_POST['message']));
            
$comment_module $_POST['module'];
            
$comment_chapter $_POST['chapter'];
            
$comment_page $_POST['page'];
            
$comment_parent_id $_POST['comment'];
            
$comment_date GetCurrentDateAndTime();
            
$comment_user_id $_SESSION['user']['user_id'];
            if (
strlen(trim($comment_text)) == 0)
            {
                
$res['error'] = $ULANG['AMCMS_comments']['CommentCannotBeEmpty'];
                
$res['status'] = 'error';        
                echo 
json_encode($res);            
                die;
            }
            
$sql "INSERT INTO AMCMS_comments (comment_text, comment_date, comment_module, comment_chapter, comment_page, comment_user_id, comment_parent_id) VALUES ('$comment_text', '$comment_date', '$comment_module', '$comment_chapter', '$comment_page', '$comment_user_id', '$comment_parent_id')";
            
mysql_query($sql);
            
$res['html'] = Comments::GetComments($comment_module$comment_chapter$comment_page);
            
$res['status'] = 'ok';        
            echo 
json_encode($res);
            die;
        }
        if (
$_POST['oper'] == 'editcomment')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;            
            
            
$comment_text     $_POST['text'];
            
$comment_module $_POST['module'];
            
$comment_chapter $_POST['chapter'];
            
$comment_page $_POST['page'];
            
$comment_id $_POST['id'];
            
$comment_user_id $_SESSION['user']['user_id'];
            if ((
$_SESSION['user']['user_access']['admin'] != 'Y') and 
                (
$_SESSION['user']['user_access']['comments'] != 'Y'))
            {
                
$comment $this->Table->getRowById($comment_id);
                if (
$comment['comment_user_id'] != $comment_user_id)
                {
                    
$r['status'] = 'error';
                    echo 
json_encode($r);
                    die;
                }
            }
            
            
$sql "UPDATE AMCMS_comments SET comment_text = '{$comment_text}' WHERE comment_module = '{$comment_module}' AND comment_chapter = '{$comment_chapter}' AND comment_page = '{$comment_page}' AND comment_id = '{$comment_id}' ";
            
mysql_query($sql);
            
$r['status'] = 'ok';
            echo 
json_encode($r);
            die;
        }
        if (
$_POST['oper'] == 'delete0' || $_POST['oper'] == 'delete2' || $_POST['oper'] == 'delete1' || $_POST['oper'] == 'delete3')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;                        
            
$code 0;
            if (
$_POST['oper'] == 'delete1'$code 1;
            if (
$_POST['oper'] == 'delete2'$code 2;
            if (
$_POST['oper'] == 'delete3'$code 3;
            
$id $_POST['id']; 
            
$comment $this->Table->GetRowById($id);
            if ((
$comment['comment_user_id'] != $_SESSION['user']['user_id']) and
                (
$_SESSION['user']['user_access']['admin'] != 'Y') and 
                (
$_SESSION['user']['user_access']['comments'] != 'Y'))
                die;
            if (
$comment['comment_user_id'] == $_SESSION['user']['user_id'] && $code == 3)
                
$code 2;
            
$sql "UPDATE AMCMS_comments SET comment_status = '{$code}' WHERE comment_id = '{$id}'";
            
mysql_query($sql);
            
$r['status'] = 'ok';            
            
$r['code'] = $code;
            echo 
json_encode($r);
            die;
        }
        if (
$_POST['oper'] == 'spamY' || $_POST['oper'] == 'spamN')
        {
            if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;            
            
            
$code 'Y';
            if (
$_POST['oper'] == 'spamN'$code 'N';
            
$id $_POST['id']; 
            
$sql "UPDATE AMCMS_comments SET comment_spam = '{$code}' WHERE comment_id = '{$id}'";
            
mysql_query($sql);
            
$r['status'] = 'ok';            
            
$r['code'] = $code;
            echo 
json_encode($r);
            die;
        }
    }
    static function 
CommentAdd($comment_module$comment_chapter$comment_page$comment_user_id$comment_text$comment_parent_id 0)
    {
        if (
$_SESSION['user']['user_blacklisted'] == || $_SESSION['user']['user_ban'] == 1)
                return;                    
        
$comment_date GetCurrentDateAndTime();
        
$comment_text str_replace("  ""&nbsp; "htmlspecialchars($comment_text));
        
$sql "INSERT INTO AMCMS_comments (comment_text, comment_date, comment_module, comment_chapter, comment_page, comment_user_id, comment_parent_id) VALUES ('$comment_text', '$comment_date', '$comment_module', '$comment_chapter', '$comment_page', '$comment_user_id', '$comment_parent_id')";
        
mysql_query($sql);
    }
    function 
User()
    {                
         global 
$ulang$ULANG;    
    }                
}

$Modules ['Comments'] = new Comments();
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.03 ]--