...

View Full Version : Parse Error



dswimboy
04-06-2004, 10:54 PM
I have a login script. then index page either displays login information, or forwards the user to the next page. i came home today, to find my script not functioning. it was working fine last night, and i don't remember changing anything.
anyway, my errors are as follows:
Parse error: parse error, unexpected $end in functions.php on line 53

Fatal error: Call to undefined function: display_login() in list.php on line 5

index.php contains

<?php
session_start();
require 'functions.php';
if (isset($_POST['username'])) {
login($_POST['username'], $_POST['password']);
} else {
display_login();
}
?>
functions.php contains

<?php
function login($name, $pass) {
$lines = file ('pass.txt');
$fuser = trim($lines[0]);
$fpass = trim($lines[1]);
if ( ($_POST['username'] == $fuser) && ($_POST['password'] == $fpass) ) {
$_SESSION['authed'] = true;
header("Location: list.php");
exit;
} else {
display_login("Please Try Again");
}
}
function display_login($msg = "Please Login") {
echo '<!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Holy Spirit Power</TITLE>
</HEAD>
<BODY><h1>' . $msg . '</h1><FORM action="index.php" method="post" enctype="application/x-www-form-urlencoded">
<TABLE>
<TR>
<TD> Username:
</TD>
<TD>
<INPUT TYPE="text" NAME="username">
</TD>
</TR>
<TR>
<TD> Password:
</TD>
<TD>
<INPUT TYPE="Password" name="password">
</TD>
</TR>
<TR>
<TD>
<INPUT TYPE="Submit" value="Login">
</TD>
<TD>
</TD>
</TR>
</TABLE>
</FORM></BODY></HTML>';
?>

where are my errors coming from?

raf
04-06-2004, 11:19 PM
The second error is caused by the first one.

The first one i probably becaus the
function display_login($msg = "Please Login") {

doesn't have a closing bracket. I don't see one anyway. Your file should probably end like

</FORM></BODY></HTML>';
}
?>

dswimboy
04-06-2004, 11:23 PM
thank you for fixing my stupid little error.

raf
04-06-2004, 11:35 PM
You're most welcome.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum