What's wrong?!
Posted: Sat May 06, 2006 10:32 pm
feyd | Please use
Thank you
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've tried to write a login script.
But when I try to load the login page, nothing's showing up :S
What's wrong with this script? :Code: Select all
<?
$link = mysql_connect($dbhost, $dbuname, $dbpw);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
$username = $_POST["uname"];
$password = $_POST["pwd"];
$result = mysql_query("SELECT * FROM `cw_user` WHERE uname = '$username'");
$array = mysql_fetch_assoc($result) or die (mysql_error());
if($username == $array['uname'] and md5($password) == $array['passwd'] and $array['admin'] == 1){
$_SESSION["logged_in"] = TRUE;
$_SESSION["admin"] = TRUE;
$result = TRUE;
} else { $result = FALSE; }
if($result){ echo "Du er logget inn!"; } else { echo "Du har skrevet en feil kombinasjon av brukernavn og passord!";}
echo $array['uname'];
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]