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!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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