- Impact
- 20
ok creating a user system and ive got the code layed out but it ays this error
Parse error: parse error, unexpected $end in f:binapacheapachehtdocsnew scriptinhuser systemnew folderlogin.php on line 43
so im asuimg ive either missed a $ or a ; somewhere but i cannot see it
line 43 is the last line of code
thanks
Parse error: parse error, unexpected $end in f:binapacheapachehtdocsnew scriptinhuser systemnew folderlogin.php on line 43
so im asuimg ive either missed a $ or a ; somewhere but i cannot see it
line 43 is the last line of code
PHP:
<?php
//Check for required feilds from form
if ((!$_POST[username]) || (!$_POST[password])) {
header("Location: login.php");
exit;
}
//connect to server and database
$conn = mysql_connect("localhost", "adam123", "adam123") or die(mysql_error());
mysql_select_db("contentsystem",$conn) or die(mysql_error());
//create and login
$sql = "SELECT f_name, l_name FROM auth_users WHERE username = '$_POST[username]' AND password = password('$_POST[password]')";
$result = mysql_query($sql,$conn) or die(mysql_error());
//get the number of rows in the rsult set; should be 1 if a match
if (mysql_num_rows($result) == 1) {
//if authorized, get the values of names
$f_name = mysql_result($result, 0, 'f_name');
$l_name = mysql_result($result, 0, 'l_name');
// Cookie
setcookie("auth", "1", 0, "/", "adamuk.serveftp.com", 0);
//echo success
$msg = "you are logged in";
$msg .= "<a href='secret.php'>secret.php</a>";
} else {
//redirect to login page if auth failed
echo "****";
?>
thanks