0

Is this how you make a login from a get method? I already have the data base and i'm using MYSQL.

https://code.sololearn.com/wo3GO6KDkj7u/?ref=app

5th Mar 2020, 2:35 PM
Fábio Gonçalves
Fábio Gonçalves - avatar
4 Antworten
+ 3
Here is some information from guru99 that might be helpful... https://www.guru99.com/php-forms-handling.html
5th Mar 2020, 2:45 PM
BroFar
BroFar - avatar
+ 2
First of all, you shouldnt use $_GET here but you should use $_POST otherwise the login details would be visible in the adress. You have included your database connection, but youre not doing anything with it. The database connection object has a query method that allows you to pull information from the database. So what you should do: -Use POST to pull the data from the submitted form. (Make sure to change this in the form) -Make a query to the database that pulls the login information from that user and compares it to what has been submitted in the form. -Create a session if the details match that saves the username or the email. You can load this session on all of your pages and change the contents of your pages based on whats in your session. This is possible since you can check if a session exists. Hope this helps
5th Mar 2020, 2:50 PM
Ruben Eekhof
Ruben Eekhof - avatar
+ 1
And thank you too BroFar.
6th Mar 2020, 8:41 AM
Fábio Gonçalves
Fábio Gonçalves - avatar
0
Can you show me what would that look like in code? If possible, with comments, to help me figure out what does what. Thank you a lot, for your attention.
5th Mar 2020, 11:26 PM
Fábio Gonçalves
Fábio Gonçalves - avatar