27 lines
919 B
PHP
27 lines
919 B
PHP
<?php
|
|
// On cache les webhooks discord => Correction de faille de sécurité
|
|
require_once('../../idDiscord.php');
|
|
|
|
// Fonction qui va ENVOYER des logs sur le webhook discord
|
|
function sendLog($action, $user="") {
|
|
$webhook = ID_DISCORD1; // URL du webhook Discord
|
|
$contenuLog = "**Nouvelle log du portfolio**\n\n";
|
|
$contenuLog .= "**Action :** " . $action . "\n";
|
|
if ($user != "") {
|
|
$contenuLog .= "**Utilisateur :** " . $user . "\n";
|
|
} else {
|
|
$contenuLog .= "**Utilisateur :** non défini". "\n";
|
|
}
|
|
|
|
$data = [
|
|
"content" => $contenuLog
|
|
];
|
|
|
|
$dataJson = json_encode($data);
|
|
|
|
$ch = curl_init($webhook); // On démarre une ressource curl
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
} |