- Apr 10, 2000
- 19,579
- 17
- 81
i dunno if this is the right forum for this but i have a php question.
i'm trying to setup a simple password page with a mysql database.
Here's what I have so far:
<?
if ($submit)
{
$db=mysql_connect("localhost","user") or die ("cant connect");
mysql_select_db("users",$db) or die ("cant change");
$result=mysql_query("select * from users where name='$username'",$db) or die ("cant do it");
while ($row=mysql_fetch_array($result))
{
if ($row["password"]==$password)
{
printf("Successfully Logged In!<a href=\\"index2.html?\\"'>Click Here</a>");
}
}
}
?>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<form method=post action="<?echo $PHP_SELF?>">
<table cellpadding=2 cellspacing=0 border=0>
<td>Username:</td><td><input type="text" name="username" size=10></td><tr>
<td>Password:</td><td><input type="password" name="password" size=10></td><tr>
<td></td><td><input type="submit" name="submit" value="Log In"></td>
</table></form>
</BODY>
</HTML>
it's not working right though
here's what it shows:
Click Here"); } } } ?>
Username:
Password:
i'm trying to setup a simple password page with a mysql database.
Here's what I have so far:
<?
if ($submit)
{
$db=mysql_connect("localhost","user") or die ("cant connect");
mysql_select_db("users",$db) or die ("cant change");
$result=mysql_query("select * from users where name='$username'",$db) or die ("cant do it");
while ($row=mysql_fetch_array($result))
{
if ($row["password"]==$password)
{
printf("Successfully Logged In!<a href=\\"index2.html?\\"'>Click Here</a>");
}
}
}
?>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
<form method=post action="<?echo $PHP_SELF?>">
<table cellpadding=2 cellspacing=0 border=0>
<td>Username:</td><td><input type="text" name="username" size=10></td><tr>
<td>Password:</td><td><input type="password" name="password" size=10></td><tr>
<td></td><td><input type="submit" name="submit" value="Log In"></td>
</table></form>
</BODY>
</HTML>
it's not working right though
here's what it shows:
Click Here"); } } } ?>
Username:
Password: