Ask coding questions

← Back to all posts
How do i access data from outside the public folder
ike_fite (14)

I'm making a website and I want to put the admin folder out of the public directory. (for obvious security reasons) I don't know how to do that. My guess is that I'm going to have to do that on the server-side, but I need some help.

Thanks.

Answered by Coder100 (16759) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (16759)

well, the thing is, how you are doing this is incorrect. You are right now just blindly hosting it on the website without having any check of any cookies.

ike_fite (14)

But how do I do a cookie check without having to worry about "inspect element hackers" for a lack of a better term. I will also run into issues if they turn off cookies. @Coder100

Coder100 (16759)

@ike_fite oh, by like basically assigning admins a secret key in your .env only you know about

Coder100 (16759)

so yes, people can change cookies, but remember you are only checking cookie value, and if it doesn't exist it won't affect that @ike_fite

ike_fite (14)

The problem with using env files is I'm going to host this elsewhere @Coder100
Edit: After I sent this I realized that if I deal with cookies on server-side I won't run into this issue.

Coder100 (16759)

yeah
when you are going to host this elsewhere, still put the key in some file you won't commit so then you don't accidentally reveal it. @ike_fite

anastefanyuk (0)

Hello! Well, this is quite a task I guess, so if you are still looking for a solution, I think this article might be quite helpful for you. If this helps, give feedback please, it will be much appreciated.

Chewyblockguy (9)

I recomend checking out this link https://www.quora.com/How-do-I-block-inspect-element-on-my-website. be careful as it has no moderated chat. thats for the inspecting. for the rest just do <script src="admin-repl.username.repl.co></script> to embed it for more privacy you should just upgrade to hacker and make it a private repl.