lundi 4 octobre 2021

How Can I reject the user have not login so they can't get the file from my website

How Can I reject the user have not login so they can't get the file from my website.

Like using google drive, I can't get the file if I didn't login.

How to make something like google drive. I mean how to deny users access to files on the server.
See if he is logged in.
Reject the user who is not logged in, but if the user is logged in, give him the file.

I am NOT asking questions about general computing hardware and software

I now use js to express my thoughts:

function getFile(){
    if (login){
        // give user the file
    }
    else {
        // Kick him out!!!! (I mean do not give the file to him)
    }

}

But I don't want someone to get from the link

Like My file link is https://www.example.com/file.exe

When I didn't login, but I visit https://www.example.com/file.exe it will redirt me to another website (https://www.example.com/401.html)

if(!login){
    top.location = 'https://www.example.com/401.html'
}

I think my expression is clear enough. If you still don’t understand, please ask questions instead of pressing the down button.




Aucun commentaire:

Enregistrer un commentaire