How make a login form and fetch username & password also validate it from REST api call.. no use of framework. Code examples | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 4

How make a login form and fetch username & password also validate it from REST api call.. no use of framework. Code examples

To integrate REST api in PHP

18th Feb 2018, 8:38 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
16 Respostas
+ 4
<html> <head> <title>Forms</title> </head> <body> <script> function checkUserAndPass() { var userName = document.getElementById(ā€œuserā€).value; var passWord = document.getElementById(ā€œpassā€).value; if (userName == ā€œRajkumar Yadavā€ && passWord == ā€œSoloLearnā€) { document.write(ā€œCorrectā€); } else { document.write(ā€œWrongā€); } } </script> <form onSubmit = ā€œcheckUserAndPass()ā€> <input type = ā€œtextā€ id = ā€œuserā€/> <input type = ā€œpasswordā€ id = ā€œpassā€/> <input type = ā€œsubmitā€/> </form> </body> </html>
27th Mar 2018, 1:12 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 3
That should work:)
27th Mar 2018, 1:12 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 3
you would have to run either a hash or a salt or md5 on the string that youā€™re using as the password and then test it using a conditional statement
27th Mar 2018, 11:18 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
using php?
27th Mar 2018, 8:08 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
+ 2
nope
27th Mar 2018, 11:16 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
oh wait are you asking how to do it using php
27th Mar 2018, 11:16 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
i could write one for you and get back to you later today
27th Mar 2018, 11:19 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
yes.....right
27th Mar 2018, 11:19 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
+ 2
I m asking how to do it using php....
27th Mar 2018, 11:21 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
+ 2
probably around 12-1 i would be finished
27th Mar 2018, 11:21 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
thnx
27th Mar 2018, 11:22 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
+ 2
yeah iā€™ll write one for you that does the password and username thing in php
27th Mar 2018, 11:23 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
I want to learn PHP codeIgniter framework
27th Mar 2018, 11:23 AM
Rajkumar Yadav
Rajkumar Yadav - avatar
+ 2
and no problem
27th Mar 2018, 11:23 AM
Leroy Jenkins
Leroy Jenkins - avatar
+ 2
sounds good
27th Mar 2018, 11:24 AM
Leroy Jenkins
Leroy Jenkins - avatar
12th Apr 2018, 4:34 PM
Programmer Gaurav
Programmer Gaurav - avatar