首页 >社区问答列表 >请问要触发这个file_get_content 给一下解题思路也好....

请问要触发这个file_get_content 给一下解题思路也好....

<?php

highlight_file(__FILE__);

error_reporting(0);

class Game{

    public  $username;

    public  $password;

    public  $choice;

    public  $register;

    public  $file;

    public  $filename;

    public  $content;

    

    public function __construct()

    {

        $this->username='user';

        $this->password='user';

    }

    public function __wakeup(){

        if(($this->register)==="admin"){

            $this->choice=new login($this->file,$this->filename,$this->content);

        }else{

            $this->choice = new register();

        }

    }

    public function __destruct() {

        $this->choice->checking($this->username,$this->password);

    }

}

class login{

    public $file;

    public $filename;

    public $content;

    public function __construct($file,$filename,$content)

    {

        $this->file=$file;

        $this->filename=$filename;

        $this->content=$content;

    }

    public function checking($username,$password)

    {

        if($username==='admin'&&$password==='admin'){

            $this->file->open($this->filename,$this->content);

            die('login success you can to open shell file!');

        }

    }

}

class register{

    public function checking($username,$password)

    {

        if($username==='admin'&&$password==='admin'){

            die('success register admin');

        }else{

            die('please register admin ');

        }

    }

}

class Open{

    function open($filename, $content){

        echo file_get_contents($filename);

    }

}

@unserialize(base64_decode($_POST['unser']));

}

这是老师发的一个题目,因为PHP学习还没有那么深入,所以希望能有一个解题思路

  • 查无此人
  • 查无此人    2021-03-26 15:58:081楼

    问题不够详情。

    file_get_contents() 函数把整个文件读入一个字符串中。

    这个可以抓取数据,不过现在curl的功能更好。

    +0添加回复

  • 回复