asp.net - custom authentication to form authentication -


Currently, my site contains a table in that database that contains the username and password. There are 2 text boxes and login buttons in front end. Once the user fills that two fields and clicks on the login, it checks that the username and password will match in the database, if so, then they should be included in the interactive site Set in the session variable to check through medium. is it safe? How do I change it to create authentication? I do not want to exclude my login table. Can I still use it if I want to change it to certification? Can someone talk to me or show me how this can be done? Thanks

The standard login using this is:

index.html :

  & lt; Form action = "login.php" method = "post" & gt; & Lt; Width of table = "100%" range = "0" style = "border-top: 2px solid # ccc; padding-top: 15px;" & Gt; & Lt; TR & gt; & Lt; Td> & Lt; input type = "text" class = "text_box" placeholder = "user" name = "user" id = "user" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "password" class = "text_box" placeholder = "contracease ± A" name = "pass" id = "pass" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt ;? Php show_message (); ? & Gt; & Lt; Input type = "submit" value = "indicer" class = "button_submit" & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Form & gt;   

and php ...

  & lt ;? Php if (isset ($ _ POST ["user"]) & amp; amp;; isset ($ _POST ["pass"])) {Include ('conect_to_database.php'); $ User = $ _POST ["user"]; $ Pass = $ _POST ["pass"]; If (! Filter_var ($ _ POST ["user"], FILTER_VALIDATE_EMAIL)) {// is not a valid email ... back to the form header ('location: index.php'); Go out(); } $ Query = "User SELECT id where user =? And pass =? LIMIT 1"; $ Stmt = $ mysqli- & gt; Ready ($ query); $ Stmt-> Tie-up ("ss", $ user, $ pass); $ Stmt- & gt; Executed (); $ Stmt- & gt; Bind_result ($ id); While ($ stmt-> fetch ()) // Set your session variable header ('location: ../../control_panel.php'); Go out(); } // Invalid user echo ... sends back the form header ('location: index.php'); }? & Gt;   

I also recommend checking the special characters in both the user and password.

In addition, you should never store a password in your database. You must store a hash of the real password using special algorithms.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -