37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
|
<?php
|
|||
|
header('content-type: text/html; charset=utf-8');
|
|||
|
if(isset($_POST["passwd"]) && !empty($_POST["passwd"])){
|
|||
|
if($_POST["passwd"] !== "Password???YouWantOneß") {
|
|||
|
echo "Falsches Kennwort";
|
|||
|
exit();
|
|||
|
}
|
|||
|
} else {
|
|||
|
echo "Falsches Kennwort";
|
|||
|
exit();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
$token = "xoxp-SLACK TOKEN XOCOCO";
|
|||
|
if(isset($_POST["email"]) && !empty($_POST["email"])){
|
|||
|
if (filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
|
|||
|
$url = "https://thetownserver.slack.com/api/users.admin.invite?email=" . $_POST["email"] . "&token=" . $token . "&set_active=true";
|
|||
|
|
|||
|
$ch = curl_init();
|
|||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|||
|
curl_setopt($ch, CURLOPT_URL,$url);
|
|||
|
$result=curl_exec($ch);
|
|||
|
curl_close($ch);
|
|||
|
|
|||
|
$jsonR = json_decode($result, true);
|
|||
|
if($jsonR["ok"]){
|
|||
|
echo "SUCCESS: Dir wurde erfolgreich eine Einladung zugesendet!";
|
|||
|
} else {
|
|||
|
echo "Es ist ein Slack Fehler aufgetreten: " . $jsonR["error"];
|
|||
|
}
|
|||
|
} else {
|
|||
|
echo "Die eingegebende Email ist nicht gültig";
|
|||
|
}
|
|||
|
} else {
|
|||
|
echo "Keine Email wurde angegeben";
|
|||
|
}
|