<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[PHP Forums - PHP/MySql Login Verification]]></title>
		<link>http://phpforums.org/topic32-phpmysql-login-verification.html</link>
		<description><![CDATA[The most recent posts in PHP/MySql Login Verification.]]></description>
		<lastBuildDate>Fri, 06 Aug 2010 07:20:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: PHP/MySql Login Verification]]></title>
			<link>http://phpforums.org/post70.html#p70</link>
			<description><![CDATA[<p>Hi .. Yes You have to create these two files </p><p>include &#039;library/config.php&#039;;<br />Inside the above file you can put code some thing like this<br /></p><div class="codebox"><pre><code>&lt;?php
$host = &quot;localhost&quot;;//Your mysql host name
$user = &quot;root&quot;;  //Username to access the database;
$pass = &quot;password&quot;;//Password to access the database;
$db = &quot;_db_name&quot;;//The database where you created the tables
?&gt;</code></pre></div><br /><p>include &#039;library/opendb.php&#039;;</p><p>then in opendb.php add the following code<br /></p><div class="codebox"><pre><code>&lt;?php
mysql_connect(  $host, $user, $pass  ) or die( mysql_error() );
mysql_select_db(  $db );
?&gt;</code></pre></div><br /><p>Try this .. have a nice time ..</p>]]></description>
			<author><![CDATA[null@example.com (aneeshrp)]]></author>
			<pubDate>Fri, 06 Aug 2010 07:20:11 +0000</pubDate>
			<guid>http://phpforums.org/post70.html#p70</guid>
		</item>
		<item>
			<title><![CDATA[PHP/MySql Login Verification]]></title>
			<link>http://phpforums.org/post65.html#p65</link>
			<description><![CDATA[<p>Hey guys,&nbsp; I&#039;m a new web developer doing things kinda out of my reach so if I sound stupid I&#039;m sorry.&nbsp; I am trying to create a mysql database with usernames and passwords which php will connect to and verify, then in turn redirect the user accordingly.&nbsp; I found a script that does just that but I have some questions about it.<br />I created the Mysql database as such...<br /></p><div class="codebox"><pre><code>CREATE TABLE tbl_auth_user (
user_id VARCHAR(10) NOT NULL,
user_password CHAR(32) NOT NULL,

PRIMARY KEY (user_id)
);

INSERT INTO tbl_auth_user (user_id, user_password) VALUES (&#039;theadmin&#039;, PASSWORD(&#039;chumbawamba&#039;));
INSERT INTO tbl_auth_user (user_id, user_password) VALUES (&#039;webmaster&#039;, PASSWORD(&#039;webmistress&#039;));


//Now that that is created I looked at the PHP code and this is what I have questions on.

&lt;?php
// we must never forget to start the session
session_start();

$errorMessage = &#039;&#039;;
if (isset($_POST[&#039;txtUserId&#039;]) &amp;&amp; isset($_POST[&#039;txtPassword&#039;])) {
   include &#039;library/config.php&#039;;
   include &#039;library/opendb.php&#039;;

   $userId = $_POST[&#039;txtUserId&#039;];
   $password = $_POST[&#039;txtPassword&#039;];

   // check if the user id and password combination exist in database
   $sql = &quot;SELECT user_id
           FROM tbl_auth_user
           WHERE user_id = &#039;$userId&#039;
                 AND user_password = PASSWORD(&#039;$password&#039;)&quot;;

   $result = mysql_query($sql)
             or die(&#039;Query failed. &#039; . mysql_error());

   if (mysql_num_rows($result) == 1) {
      // the user id and password match,
      // set the session
      $_SESSION[&#039;db_is_logged_in&#039;] = true;

      // after login we move to the main page
      header(&#039;Location: main.php&#039;);
      exit;
   } else {
      $errorMessage = &#039;Sorry, wrong user id / password&#039;;
   }

   include &#039;library/closedb.php&#039;;
}
?&gt;</code></pre></div><p>The part that confuses me is the library directory.&nbsp; Do I actually have to create a library directory and the files called closedb.php and opendb.php or is this some apache built in server feature.&nbsp; If i do need to create the directory... are these files already created?&nbsp; The reason I ask is because in the tutorial he gave no source to these files, so I am wondering if they are a standard web script that can be obtained someplace.</p><p>Thank you for any input you may have in advance,<br />Squeaker2</p>]]></description>
			<author><![CDATA[null@example.com (squeaker2)]]></author>
			<pubDate>Sun, 25 Jul 2010 22:46:03 +0000</pubDate>
			<guid>http://phpforums.org/post65.html#p65</guid>
		</item>
	</channel>
</rss>

