Ideas on a very simple, yet secure login

2019-09-12 23:56发布

I want a very simple login functionality integrated into a form on my server. It would be for use with only one page. You login in order to upload files to the server. I use a Linux at the moment. Does anyone have an idea of where I could get an idea where to get started. I have HTTPS/SSL Certificate on the server so it will help. But I don't really want to get complicated, only enough to stay secure. Ideas? Hope I'm in the right place. I'd like to use PHP to do this. The goal is to create a login without using SQL maybe, as it is only for one or two users.

3条回答
Animai°情兽
2楼-- · 2019-09-13 00:51

Something like,

$hash = "precomputed hash of your password";
if (crypt($_POST['password'], '$6$rounds=5000$usesomesillystringforsalt$') == $hash)  {
   ...
}

No database is needed.

查看更多
Root(大扎)
3楼-- · 2019-09-13 00:52

You could just use htaccess to password-protect a directory (cpanel/plesk make this easy to do), or give your users an FTP account to upload files.

Either one would be quick and easy to setup, with FTP being more secure (assuming a reasonable password).

查看更多
一夜七次
4楼-- · 2019-09-13 01:00

its easy, you just nees to filter input so that your script save from sql injection, if you want to build this functionality on same page then u must use propper conditions to check incoming post data,

php's FILTER_SANITIZE_(check string,password,number,or other things) is very handy in this way

查看更多
登录 后发表回答