problems with login script
- From: morph.1989@xxxxxxxxx
- Date: Mon, 19 May 2008 04:36:24 -0700 (PDT)
Hi, I can't get this script to work.
I've used this exact script on other places and it works, but now i
get this error.
<code> Warning: mysql_fetch_array(): supplied argument is not a valid
MySQL result resource in C:\xampp\htdocs\uploads\login_script.php on
line 15 </code>
I can't see what is wrong.
Here is the script.
<code>
<?php
session_start();
$anvnamn = $_POST['usr'];
$losenord = $_POST['pwd'];
include "dbconnect.php";
$anv2 = mysql_real_escape_string($anvnamn, $dbconnect);
$los2 = mysql_real_escape_string($losenord, $dbconnect);
$sqlfraga = "SELECT anvnamn FROM administrator WHERE anvnamn = '" .
$anvnamn . "' AND losen = '" . $losenord . "'";
$res = mysql_query($sqlfraga, $dbconnect);
if($rad = mysql_fetch_array($res))
{
$_SESSION['logged_in_admin'] = true;
}
else
{
$_SESSION['logged_in_admin'] = false;
}
?>
<html>
<body>
<?php
if($_SESSION['logged_in_admin'])
{
echo("You are logged in");
include('index.php');
}
else
{
echo ("go away");
}
?>
</body>
</html>
</code>
.
- Follow-Ups:
- Re: problems with login script
- From: "Álvaro G. Vicario"
- Re: problems with login script
- From: Rik Wasmus
- Re: problems with login script
- From: Robin
- Re: problems with login script
- From: Sjoerd
- Re: problems with login script
- Prev by Date: PDO: Switch database user without reopening connection
- Next by Date: Re: PDO: Switch database user without reopening connection
- Previous by thread: PDO: Switch database user without reopening connection
- Next by thread: Re: problems with login script
- Index(es):
Relevant Pages
|