从管理面板上传照片

时间:2018-04-02 10:54:51

标签: upload admin panel photo

我的网站有问题,我尝试更改其中的一些内容,而对于新闻页面,我尝试在管理面板中选择上传图片的新闻,就像每次在新闻中添加帖子一样页面,添加1张照片。

编写本网站脚本的人有一个奇怪的脚本。

对于管理面板,脚本就像那样

       case 'news':
            echo "
                <input type='text' class='ucp_input' id='news_title' placeholder='Titlu'><br>
                <font style='font-size:11px;'>Te rog s&#259; folose&#351;ti &#92;n pentru linie nou&#259;!</font><br>
                <textarea class='acp_textarea' id='news_content' placeholder='Con&#355;inut'></textarea><br>
                Data expir&#259;rii:<br>
                <select id='news_expire_y' onchange='putMonths(\"news\")' class='acp_select'><option value='-1'>An</option></select>&nbsp;<select class='acp_select' id='news_expire_m' onchange='putDays(\"news\")'><option value='-1'>Luna</option></select>&nbsp;<select class='acp_select' id='news_expire_d'><option value='-1'>Zi</option></select><br>
                <div id='acp_res' style='color:#f00;font-size:12px;'></div><br>
                <img src='/img/ucp/submit.png' style='cursor:pointer;' onclick='addNews()'>";
            break;

在函数中我有这个

    function add_news($title,$content,$y,$m,$d)
    {
        $title=  addentities($title);
        $content=  addentities($content);
        $y=  intval(addentities($y));
        $m=  intval(addentities($m));
        $d=  intval(addentities($d));
        $content=str_replace("&#92;n","<br>",$content);
        $st=0;
        if($title==""){
            $msg="Noua postare trebuie s&#259; aib&#259; un titlu.";
        }else if($content==""){
            $msg="Noua postare trebuie s&#259; aib&#259; un con&#355;inut!";
        }else if($y==-1 || $m==-1 || $d==-1){
            $msg="Noua postare trebuie s&#259; aib&#259; o data de expirare!";
        }else if($y<intval(date("Y")) || ($y==intval(date("Y")) && $m<intval(date("m"))) || ($y==intval(date("Y")) && $m==intval(date("m")) && $d<intval(date("d")))){
            $msg="Data expirarii nu poate fi &#238;n trecut.";
        }else{
            $expire=mktime(date("H"),date("i"),date("s"),$m,$d,$y);
            $now=time();
            $sql="insert into account.kwix_news_ro (`title`,`content`,`time`,`expire`) values ('$title','$content','$now','$expire')";
            $rez=mysql_query($sql);
            if($rez){
                $msg="<font color='green'>Success!</font>";
                $st=1;
            }else{
                $msg="Am &#238;ntampinat o problem&#259;.Te rug&#259;m s&#259; &#238;ncerci din nou.";
            }
        }
        return json_encode(array("st"=>$st,"msg"=>$msg));
    }
function get_news($ref,$_id=0)
    {
        $title="";
        $content="";
        $date="";
        $id='';
        $next=0;
        $time=time();
        if(intval($ref)==1){
            $sql="select * from account.kwix_news_ro where `expire`>'$time' order by `time` desc";
        }elseif(intval($ref)==2){
            $_id=  intval(addentities($_id));
            $sql="select * from account.kwix_news_ro where `expire`>'$time' and `id`<".$_id." order by `time` desc";
        }else{
            $_id=  intval(addentities($_id));
            $sql="select * from account.kwix_news_ro where `expire`>'$time' and `id`>".$_id." order by `time` asc";
        }
        $rez=mysql_query($sql);
        $row=mysql_num_rows($rez);
        if($row){
            $rand=mysql_fetch_array($rez);
            $title=$rand['title'];
            $time=$rand['time'];
            $content=$rand['content'];
            $date=date("d/m/Y H:i",$time);
            $id=$rand['id'];
        }
        if($row>=2){
            $next=1;
        }
        $prev=0;
        if(intval($ref)==2){
            $sql="select * from account.kwix_news_ro where `expire`>'$time' and `id`>=".$_id;
            $rez=mysql_query($sql);
            $row=  mysql_num_rows($rez);
            if($row) $prev=1;
        }elseif(intval($ref)==3){
            $time=time();
            $sql="select * from account.kwix_news_ro where `expire`>'$time' and `id`>".($id);
            $rez=mysql_query($sql);
            $row=  mysql_num_rows($rez);
            if($row) $prev=1;
            $next=1;
        }
        exit(json_encode(array("image"=>$image,"title"=>$title,"content"=>$content,"date"=>$date,'id'=>$id,"next"=>$next,"prev"=>$prev)));
    }

1个名为add_news.php的文件

    <?php
require '../inc/functions.php';
require '../inc/config.php';
if(isset($_GET['title']) && isset($_GET['content']) && isset($_GET['y']) && isset($_GET['m']) && isset($_GET['d']) && is_admin()){
    $title=$_GET['title'];
    $content=$_GET['content'];
    $y=$_GET['y'];
    $m=$_GET['m'];
    $d=$_GET['d'];
    echo add_news($title, $content, $y, $m, $d);
}
?>

和get_news.php

    <?php
require '../inc/functions.php';
require '../inc/config.php';
if(isset($_GkET['first']))
{
    get_news(1);
}else if(isset($_GET['id']) && isset($_GET['next'])){
    get_news(2,$_GET['id']);
}else if(isset($_GET['id']) && isset($_GET['prev'])){
    get_news(3,$_GET['id']);
}
?>

我真的不明白它的加密模式,如何在不改变旧脚本的情况下制作正确的脚本。

0 个答案:

没有答案