![]() |
|
[PHP] [help] Need a guide on how to make a secure admin section - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] [help] Need a guide on how to make a secure admin section (/showthread.php?tid=2564825) |
[help] Need a guide on how to make a secure admin section - Webman.io - Jun 7, 2012 Need a guide on how to make a secure admin section with login and logout function. And then also with some admin secure pages which only the admin can see when logged in. Anyone know such? * - Novalty - Jun 7, 2012 I could code you something like this if you wanted. Shouldn't be too hard! * - Webman.io - Jun 7, 2012 (Jun 7, 2012 02:16 PM)novalty Wrote: I could code you something like this if you wanted. Shouldn't be too hard! But I am not pretty good at this yet. I have worked with SQL and PHP before, but I have no clue on making login. As I don't know what it would require. * - Novalty - Jun 7, 2012 Here is a very basic shell for the code you want. Fill it up with as much stuff as you want but this is the very basics of a MySQL login system. I have not protected it against any kinds of attacks but if you search around for a minute or two you can find very good resources for protecting your scripts. I would also recommend recoding my example into OOP, and using PDO for the database work. login.php PHP Code functions.php PHP Code private.php PHP Code database structure Code name: users* - Webman.io - Jun 7, 2012 (Jun 7, 2012 02:54 PM)novalty Wrote: Here is a very basic shell for the code you want. Fill it up with as much stuff as you want but this is the very basics of a MySQL login system. thanks a lot for this. But it looks like it also needs a salt field in the database? But what should I put in there to make it work? * - Novalty - Jun 8, 2012 Oh haha! My bad :P To get yourself as a working user, run a password and a salt through the hashPass() function. Pass - your desired password Salt - Random string of characters. Use something like the following: sftr620aw2 Echo out the returned value from that function. Copy the value/hash that you see on your screen and put it into your database under 'password'. Then copy the salt you used and put that into the 'salt' column in the database * - Dankki - Jun 8, 2012 You should mysql_real_escape_string the values before trying to check them from the db. * - Novalty - Jun 8, 2012 (Jun 8, 2012 03:35 AM)Dankki Wrote: You should mysql_real_escape_string the values before trying to check them from the db. I had stated I did not provide any protection novalty Wrote:I have not protected it against any kinds of attacks but if you search around for a minute or two you can find very good resources for protecting your scripts. * - Bassline - Jun 8, 2012 Perhaps: Code <?phpTaken from: http://stackoverflow.com/questions/6650032/is-this-a-secure-php-administration-page * - systemcarnage - Jun 8, 2012 you could encrypt the data that is being transferred from client to server or other way around.. |