http://files.mydoamin/list.txt?username:user?password:pwd
<?php
if (isset($url)) {
if (isset($_GET['username']) && isset($_GET['password'])){
// if the log is correct
echo '<form action="yourscript.php" method="post">
<input type="button" class="btn btn-default" onclick="window.location=\'file.txt\'" value="exportTXT">
</p>
</form>';
} else {
// log fail... retry
header('Location: index.php');
exit();
}
}
?>
Hope this will help you.
What you need to do is to implement an API.
The API will receive both parameters and you can do a simple file where you can have "username and password"
So every time you get a call
https://myweb.com?username:user1&password:pwd1 (works)
https://myweb.com?username:user1 (fail missing password)
https://myweb.com?password:pwd1 (fail missing username)
https://myweb.com (fail missing both username and pwd).
Check if the request has the username and password and also make sure that they're valid.
Once this is checked it can download the file.
https://stackoverflow.com/questions/10937524/how-should-i-pass-multiple-parameters-to-an-asp-net-web-api-get