About this script.
This script checks to see if the user is logged on before he/she can dl a template. then gets the template id from a post, then forwards to it.
Im having problems with my script, i session is there, but it wont instert the varible $username and $password. to the mysql query. I know that the session is there, because if it doesnt connect i have it displaying the username. The username and password it is trying to connect with exist.
Also, when i change the $username and $password varible to a user and a password that is in the db, it works fine.
<?php session_start();
$download = $POST['template'];
$username == $SESSION['username'];
$password == $_SESSION['password'];
$conn=@mysql_connect( "localhost", "template_ray", "--------" )
or die( "Could not connect" );
$rs = @mysql_select_db( "template_users", $conn )
or die( "Could not select database" );
$sql = "select * from users where username= \"$username\" and password = password( \"$password\" )";
$rs = mysql_query( $sql, $conn )
or die( "Could not execute query" );
$num = mysql_numrows( $rs );
if( $num != 0 )
{
if ($POST['template'] !=""){
$file = "c2f2a32QC/count.php?fid=" . $POST['template'];
} else {
$file = "main.php?page=notfound";
}
header( "Location:$file" ); exit();
}
else
{
echo ( $username );
}
?>