Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML login form to PHP check page to another page

Status
Not open for further replies.

rmccoy

MIS
Mar 22, 2001
4
0
0
US
I have a HTML form which is checked by a PHP page. Here is the code.

<HTML>
<HEAD>
<TITLE></TITLE>
<HEAD>
<BODY>
<?php
require (&quot;common.inc&quot;);

mysql_connect($dbserver, $dblogin, $dbpassword);
$result = mysql_query(&quot;csmgroup&quot;,&quot;SELECT * FROM userinfo WHERE user='$username' AND password='$password'&quot;);

if ($submit = mysql_fetch_array($result))
print(&quot;<meta http-equiv='refresh' content='0' URL='mediakit.htm'>&quot;);
else
print(&quot;<meta http-equiv='refresh' content='0' URL='login.htm'>&quot;);
?>
</BODY>
</HTML>
where common.inc includes the variable names $dbserver, $dblogin, and $dbpassword.

I keep getting the following errors:

Warning: MySQL Connection Failed: Access denied for user: 'csm@csmgroup.net' (Using password: YES) in /usr/local/ on line 9

Warning: Supplied argument is not a valid MySQL-Link resource in /usr/local/ on line 10

Warning: Supplied argument is not a valid MySQL result resource in /usr/local/ on line 12

Any Ideas or comments. Thanks in advance.
 
I had the same error not long ago. Instead of the line:

$result = mysql_query(&quot;csmgroup&quot;,&quot;SELECT * FROM userinfo WHERE user='$username' AND password='$password'&quot;);

try:

mysql_select_db(&quot;csmgroup&quot;);
$result = mysql_query(&quot;SELECT * FROM userinfo WHERE user='$username' AND password='$password'&quot;);

For some reason that worked for me.. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top