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
Mysql showing values
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="Dobby" data-source="post: 176804" data-attributes="member: 1559"><p>The members mage</p><p> </p><p>[PHP] <?php</p><p>session_start();</p><p>require_once("connect.php");</p><p> </p><p>// Check his status.</p><p>if (!empty($_SESSION[username])) // he got it.</p><p>{</p><p> </p><p> echo "You are currently logged in as <b>$_SESSION[username]</b>.<br>";</p><p> echo "Your Pre-Alpha rank is:";</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p>}</p><p>else // bad info.</p><p>{</p><p> echo "You are currently <b>NOT</b> logged in.";</p><p>}</p><p> </p><p>?>[/PHP]</p><p> </p><p> </p><p>Login</p><p>[PHP]<?php</p><p>session_start();</p><p>// Check if he wants to login:</p><p>if (!empty($_POST[username]))</p><p>{</p><p> require_once("connect.php");</p><p> </p><p> // Check if he has the right info.</p><p> $query = mysql_query("SELECT * FROM members</p><p> WHERE username = '$_POST[username]'</p><p> AND password = '$_POST[password]'")</p><p> or die ("Error - Login failed.");</p><p> </p><p> $row = mysql_fetch_array($query)</p><p> or die ("Error - Login failed.");</p><p> </p><p> if (!empty($row[username])) // he got it.</p><p> {</p><p> $_SESSION[username] = $row[username];</p><p> echo "Welcome $_POST[username]! You've been successfully logged in.<br>";</p><p> echo "right now the UCP is being worked on but you are on the system.<br>";</p><p> exit();</p><p> }</p><p> else // bad info.</p><p> {</p><p> echo "Error - Login failed.<br /><br /></p><p> Please try again.";</p><p> exit();</p><p> }</p><p>}</p><p> </p><p>?>[/PHP]</p></blockquote><p></p>
[QUOTE="Dobby, post: 176804, member: 1559"] The members mage [PHP] <?php session_start(); require_once("connect.php"); // Check his status. if (!empty($_SESSION[username])) // he got it. { echo "You are currently logged in as <b>$_SESSION[username]</b>.<br>"; echo "Your Pre-Alpha rank is:"; } else // bad info. { echo "You are currently <b>NOT</b> logged in."; } ?>[/PHP] Login [PHP]<?php session_start(); // Check if he wants to login: if (!empty($_POST[username])) { require_once("connect.php"); // Check if he has the right info. $query = mysql_query("SELECT * FROM members WHERE username = '$_POST[username]' AND password = '$_POST[password]'") or die ("Error - Login failed."); $row = mysql_fetch_array($query) or die ("Error - Login failed."); if (!empty($row[username])) // he got it. { $_SESSION[username] = $row[username]; echo "Welcome $_POST[username]! You've been successfully logged in.<br>"; echo "right now the UCP is being worked on but you are on the system.<br>"; exit(); } else // bad info. { echo "Error - Login failed.<br /><br /> Please try again."; exit(); } } ?>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Mysql showing values
Top