Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[PHP] Please Help [PHP]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 232553" data-attributes="member: 1872"><p>I'm assuming connect.php contains your MySQL connection details, however, in your script you make no queries to your database such as finding out whether the user exists, that's assuming you even have a users table in the database.</p><p></p><p>You also call $row but don't define it, unless it's defined in connect.php thus making it global to the current file you're in since you've included connect.php.</p><p></p><p>What you should probably do is if(!empty($_POST['username'])) rather than $row['username']</p><p></p><p>Then try $_SESSION['username'] = $_POST['username']</p><p></p><p>And then do echo 'Welcome ' . $_SESSION['username'] . ' you have been logged in.';</p><p></p><p>Of course you will need to query your database to find out if the user exists, and then also sanitize your queries and outputs to the browser to prevent XSS injections.</p></blockquote><p></p>
[QUOTE="Markshall, post: 232553, member: 1872"] I'm assuming connect.php contains your MySQL connection details, however, in your script you make no queries to your database such as finding out whether the user exists, that's assuming you even have a users table in the database. You also call $row but don't define it, unless it's defined in connect.php thus making it global to the current file you're in since you've included connect.php. What you should probably do is if(!empty($_POST['username'])) rather than $row['username'] Then try $_SESSION['username'] = $_POST['username'] And then do echo 'Welcome ' . $_SESSION['username'] . ' you have been logged in.'; Of course you will need to query your database to find out if the user exists, and then also sanitize your queries and outputs to the browser to prevent XSS injections. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[PHP] Please Help [PHP]
Top