Question: PHP , HTML and MySQL I am creating a website for a class and am struggling with connecting to the database and getting the login
PHP HTML and MySQL
I am creating a website for a class and am struggling with connecting to the database and getting the login page to redirect the user to a welcome page when the information is valid.
requirements for the site
a form that will allow users to enter their login information and when submitted it will connect to the database to check their information and allow them to connect
a button that allows the users to click it to log out. Once the button is clicked, it should redirect the user to the logout page. This page should tell them they logged out.
Write the session control script that welcomes your user to the site once they log in so that the user knows their log in worked. This can be as simple as displaying "Welcome, UserID".
Add the session control script to each page so that the user's information is passed from page to page as they go through your site. This can also be as simple as "UserID is logged in
here is the php for each page that i have so far:
connection.php
loginphp
prepareSELECT FROM userslogin WHERE Username :username AND Password :password";
$stmtbindParam:username", $username;
$stmtbindParam:password", $password;
$stmtexecute;
if $stmtrowCount
$SESSIONusername $username;
headerLocation: welcome.php;
else
echo "Invalid username or password";
$dbcclose;
welcome.php
logoutphp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
