請問要觸發(fā)這個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']));
}
這是老師發(fā)的一個題目,因為PHP學(xué)習(xí)還沒有那么深入,所以希望能有一個解題思路
問題解答
回答1:問題不夠詳情。
file_get_contents() 函數(shù)把整個文件讀入一個字符串中。
這個可以抓取數(shù)據(jù),不過現(xiàn)在curl的功能更好。
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. docker - 如何修改運行中容器的配置3. docker鏡像push報錯4. 關(guān)于docker下的nginx壓力測試5. angular.js - angularjs的自定義過濾器如何給文字加顏色?6. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題7. 前端 - @media query 使用出現(xiàn)的問題?8. html5和Flash對抗是什么情況?9. java - 如何點擊按鈕,重新運行(我是初學(xué)者)?10. html - css氣泡,實現(xiàn)“倒三角(不知道算不算三角了)”可透明的。

網(wǎng)公網(wǎng)安備