59 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| require __DIR__ . '/vendor/autoload.php';
 | |
| 
 | |
| use Jumbojett\OpenIDConnectClient;
 | |
| 
 | |
| // session_start();
 | |
| 
 | |
| // // --- OIDC login ---
 | |
| // $oidc = new OpenIDConnectClient(
 | |
| //     getenv('OIDC_ISSUER'),
 | |
| //     getenv('OIDC_CLIENT_ID'),
 | |
| //     getenv('OIDC_CLIENT_SECRET')
 | |
| // );
 | |
| 
 | |
| // if (!isset($_SESSION['user'])) {
 | |
| //     $oidc->authenticate();
 | |
| //     $_SESSION['user'] = $oidc->getVerifiedClaims();
 | |
| // }
 | |
| 
 | |
| // --- Formulaire pour créer un compte ---
 | |
| if ($_SERVER['REQUEST_METHOD'] === 'POST') {
 | |
|     $user = $_POST['username'];
 | |
|     $pass = $_POST['password'];
 | |
| 
 | |
|     $soapUser = 'SOAPUSER';
 | |
|     $soapPass = 'SOAPPASS';
 | |
|     $host = getenv('SOAP_HOST');
 | |
|     $port = getenv('SOAP_PORT');
 | |
| 
 | |
|     $command = "account create $user $pass";
 | |
|     $command = "account list";
 | |
| 
 | |
|     $client = new SoapClient(NULL, [
 | |
|         "location" => "http://mangosd:7878/",
 | |
|         "uri" => "urn:MaNGOS",
 | |
|         "style" => SOAP_RPC,
 | |
|         'login' => $soapUser,
 | |
|         'password' => $soapPass
 | |
|     ]);
 | |
| 
 | |
|     try {
 | |
|         // NOTE : ne pas mettre de préfixe ns1:
 | |
|         $result = $client->__soapCall('executeCommand', [new SoapParam($command, 'command')]);
 | |
|         echo "✅ Command executed:\n";
 | |
|         echo $result;
 | |
|         var_dump($result);
 | |
|     } catch (Exception $e) {
 | |
|         echo "❌ Command failed:\n";
 | |
|         echo $e->getMessage();
 | |
|     }
 | |
| }
 | |
| ?>
 | |
| 
 | |
| <form method="post">
 | |
|     <input type="text" name="username" placeholder="Username" required>
 | |
|     <input type="password" name="password" placeholder="Password" required>
 | |
|     <button type="submit">Create Account</button>
 | |
| </form>
 | 
