Updater script which should keep base up to date.

This commit is contained in:
UltraDesu
2018-01-17 03:43:23 +03:00
parent 0f7ae242dc
commit 94e0637ae3
5 changed files with 263 additions and 25 deletions

16
add.php
View File

@ -13,17 +13,25 @@ if (
}
else{
$url = $_POST['url'];
if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
// check url is valid
if (
filter_var($url, FILTER_VALIDATE_URL) === FALSE ||
!((parse_url($url, PHP_URL_HOST) == 'rutracker.org')) ||
!((parse_url($url, PHP_URL_PATH) == '/forum/viewtopic.php')) ||
!((parse_url($url, PHP_URL_QUERY)))
) {
die('Not a valid URL');
}
parse_str((parse_url($url, PHP_URL_QUERY)), $url);
if (!isset($url['t']))
{
die('Not a valid URL');
}
$url = $url['t'];
$username = $_POST['telegram'];
}
// check url is valid
// check user already reqested notify about this topic
// check if the same user already reqested notify about the same this topic
$stmt = $dbh->query(
'SELECT c.username, u.link FROM `contact` c
LEFT JOIN `url` u ON u.id = c.topic_id