mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-16 22:25:36 +07:00
New Feature - Report URLs
Lately, I have received relatively few requests with potentially bad URLs. On the one hand, that could be because ClearURLs are working very well by now. But I also think that not everyone wants to sign up to GitLab to report a URL. That's why I've added a new button that reports the current URL in the active tab to me, so I can take a closer look at the URL. So that you can see exactly what data will be sent to me, I have uploaded the source code for the PHP script, of course, without a password etc. Please be careful not to send URLs with personal information or tokens.
This commit is contained in:
35
server/report_url.php
Normal file
35
server/report_url.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$servername = "...";
|
||||
$username = "...";
|
||||
$password = "...";
|
||||
$dbname = "...";
|
||||
|
||||
if(isset($_GET['url'])) $url = urldecode($_GET['url']);
|
||||
else http_response_code(404);
|
||||
|
||||
if(!empty($url) && filter_var($url, FILTER_VALIDATE_URL))
|
||||
{
|
||||
$hash = md5($url);
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
http_response_code(505);
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO reports (hash, url) VALUES ('$hash', '$url')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
http_response_code(200);
|
||||
} else {
|
||||
http_response_code(500);
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
else {
|
||||
http_response_code(505);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user