Not a big problem, but i cant get over the or die error i get with my sql query.
This is the login form, and after it the action it goes to.
echo("<form enctype=\"text/plain\" action=\"login-go.php\" method=\"post\">
<input type=\"text\" name=\"fusername\" size=\"20\" value=\"username\"> <br>
<input type=\"text\" name=\"fpassword\" size=\"20\" value=\"password\"> <br>
<input type=\"submit\" name=\"submit\" value=\"Login\"></form>");
<?php
include("config.php");
if($loged=='yes')
{
echo "You are already loged in!";
echo "<p align=\"right\"><a href=\"logout.php\">Logout.</a>";
}
else
{
include("config.php");
$conn = mysql_connect("$server", "$db_user","$db_pass")
or die("Count not connect to database");
$rs = mysql_select_db("$database",$conn)
or die ("Could not select database");
$sql = 'SELECT * ';
$sql .= 'FROM `users` ';
$sql .= 'WHERE username=\"$fusername\" AND ';
$sql .= 'PASSWORD=\"$fpassword\" LIMIT 0, 30';
$rs=mysql_query($sql,$conn) or die("NOT HAVING THIS!");
$num=mysql_num_rows($rs);
if($num=="0"){echo("Sorry, login dosent exist");}
else
{
setcookie("loged","yes",time()+3600);
setcookie("username","$username",time()+3600);
setcookie("name","$name",time()+3600);
setcookie("email","$email",time()+3600);
echo("<a href=\"index.php\" style=\"font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000;\">Click here to finish loging in!</a> ");
}?>
<?php
}
?>
Whats the problem? It dont make any sense to me - it has an error with the sql query and gives me the die error. You can look at the files at
http://xeon.createworld.net/~fluppet/class/login.php
http://xeon.createworld.net/~fluppet/class/login-go.php
Can anyone help me with the sql query? its fine if i get rid of the $fusername and $fpassword, but then it goes wrong when i change it to strings not values! ARRRGG
Thanks in advance, chris.