Login form validation

Login form validation
0

#1

Hello i am new to web programming…i have created a login form (login.php) and another file (myfile.php) which contains a message “welcome user:…, your pass is:…” with method get, i have created a php script to connect my database. I want to validate only the right users not everyone who texts his password and username, how can i do that? i saw the case of session but actually i cant cleary understand how to use and what it does.


#2

Do you have the project stored on the web which where the source files can be easily view (i.e. github)? I can take a look if I can see how far you have gotten and then make recommendations on next steps.


#3

no, i have not, i am very very new with the topic…shall i send you and email to contact ?


#4

Create an account on github and post your files up there and then send me a link to the project. Github is free and easy to set up. They have an app and desktop application you can use to get your files on their site.


#5

https://github.com/png3/vallog ,the files are login.php and test.php (i have change the db settings(i believe you understand me))


#6

OK, I tested your code out. What are you expecting your code to do that it is not doing? For example, can you show me a screenshot of what happens after you click the login button?


#7


#8

i dont want evereyone that texts username and password to enter, only the members and to others display a message like “you are not a member you must register e.g”


#9

i havent understand if session can do this or i should “play” with the database


#10

Then your database needs to have a table with usernames and passwords and then you need to write code that checks to see if there the entered username and password matches a record in that table.

You will have to write an SQL statement that queries for the username and password. If a record is found, then echo the message you want the visitor to see, otherwise do not.


#11

https://www.w3schools.com/php/php_mysql_create_table.asp - for how to create mysql table

https://www.w3schools.com/php/php_mysql_select.asp - for how to query mysql table with php