- #1
aheight
- 321
- 109
Hi guys,
I am very much a novice at website management and have set up a website which accesses my SQL database and I'm not using WordPress or other site building software, and I don't understand really the mechanics of private and public access to the site file system and was wondering if someone could explain it a bit to me?
Ok, on my site, I use CPanel and have a subdirectory named public_html and I assume that is the one accessed when the website is referenced right? And then I assume when the domain name is entered as a web address, it goes to this directory and runs index.html right? And that's what I want for public viewing. However, I would also like to run a database update script using the same domain name but a different file in the subdirectory but don't want public access to it obviously. So say my domain name is "mydomain.net". So then when the public enters mydomain.net it runs the index.html file and that is fine. However, I would like the option of running a different file privately so I type:
mydomain.net/updateDatabase.html.
And that file has a php script which then updates the database. However I can just run this file publicly by typing it in at the http prompt and I don't want just anyone running it or other files on my site. Should I not keep private files in public_html? Is that a dumb question? But if I store them in another subdirectory, how do I then run them privately? I would like to have private access to this file so just me could run it. Is there a way to do this? Perhaps I could use a password in the php file since as i understand it, the php script is not viewable by the browser? I do not know if I can just log into CPanel on my site and run the updateDatabase. html file directly. Is that what is usually done it this situation?
Thanks for reading,
I am very much a novice at website management and have set up a website which accesses my SQL database and I'm not using WordPress or other site building software, and I don't understand really the mechanics of private and public access to the site file system and was wondering if someone could explain it a bit to me?
Ok, on my site, I use CPanel and have a subdirectory named public_html and I assume that is the one accessed when the website is referenced right? And then I assume when the domain name is entered as a web address, it goes to this directory and runs index.html right? And that's what I want for public viewing. However, I would also like to run a database update script using the same domain name but a different file in the subdirectory but don't want public access to it obviously. So say my domain name is "mydomain.net". So then when the public enters mydomain.net it runs the index.html file and that is fine. However, I would like the option of running a different file privately so I type:
mydomain.net/updateDatabase.html.
And that file has a php script which then updates the database. However I can just run this file publicly by typing it in at the http prompt and I don't want just anyone running it or other files on my site. Should I not keep private files in public_html? Is that a dumb question? But if I store them in another subdirectory, how do I then run them privately? I would like to have private access to this file so just me could run it. Is there a way to do this? Perhaps I could use a password in the php file since as i understand it, the php script is not viewable by the browser? I do not know if I can just log into CPanel on my site and run the updateDatabase. html file directly. Is that what is usually done it this situation?
Thanks for reading,
Last edited: