
July 27th, 2002, 02:08 PM
|
|
Contributing User
|
|
Join Date: Jun 2002
Posts: 54
Time spent in forums: < 1 sec
Reputation Power: 7
|
|
|
Cannot redeclare function
Hi all,
I have a script that checks to see if the usernames and passwords users enter are correct, but the problem is in a file called common.php, a file that contains basic variable and function definitions. Here's the error I receive: Quote: | Fatal error: Cannot redeclare errormsg() (previously declared in /usr/local/www/virtual2/66/175/22/189/html/cms/common.php:26) in /usr/local/www/virtual2/66/175/22/189/html/cms/common.php on line 26 | And the code that causes the error: (Line 26 is the one that says: function errorMsg(...) Also, in the files in which this file is include()d, there aren't any function definitions in them.
PHP Code:
<?php // common.php
// Default Width of Message Tables
$deftablewidth = "70%";
// Header Background Color
$headcolor = "#000099";
// Header Text Color
$headtextcolor = "#FFFFFF";
// Row 1 Background Color
$row1back = "#CCCCFF";
// Row 2 Background Color
$row2back = "#9999FF";
// Default Font
$defaultfont = "Verdana,Arial,Helvetica";
// Default Font Size
$defaultfontsize = "2";
/*************************************************/
function errorMsg($title, $msg) {
?>
<html>
<head>
<title>JFWCMS - <?php echo($title); ?></title>
<?php
include('includes/header.html');
?>
<br>
<table width="95%" cellspacing="0" cellpadding="1" border="0" align="center">
<tr>
<td bgcolor="<?php echo($headcolor); ?>"><font size="2" color="<?php echo($headtextcolor); ?>"><b> <?php echo($title); ?></b></font></td>
</tr>
<tr>
<td bgcolor="<?php echo($row1back); ?>"><font size="2"><?php echo($msg); ?></font></td>
</tr>
</table>
<?php
include('includes/footer.html');
exit;
}
function Msg($title, $msg) {
?>
<html>
<head>
<title>JFWCMS - <?php echo($title); ?></title>
<?php
include('includes/header.html');
?>
<br>
<table width="95%" cellspacing="0" cellpadding="1" border="0" align="center">
<tr>
<td bgcolor="<?php echo($headcolor); ?>"><font size="2" color="<?php echo($headtextcolor); ?>"><b> <?php echo($title); ?></b></font></td>
</tr>
<tr>
<td bgcolor="<?php echo($row1back); ?>"><font size="2"><?php echo($msg); ?></font></td>
</tr>
</table>
<?php
include('includes/footer.html');
exit;
}
function showLoginForm() {
?>
<html>
<head>
<title>JFWCMS - Login Required</title>
<?php
include('includes/header.html');
?>
<br><br>
<table width="95%" cellspacing="0" cellpadding="2" border="0" align="center">
<tr>
<td bgcolor="<?php echo($headcolor); ?>"><font size="2" color="<?php echo($headtextcolor); ?>"><b> System Message</b></font></td>
</tr>
<tr>
<td bgcolor="<?php echo($row1back); ?>"><font size="2">You are not logged in or you do not have permission to access this page. This could be for one of the following reasons:</font></p>
<ol>
<font size="2"><li>You are not logged in. Use the form at the bottom of this page to login with your username and password.</li></font>
<font size="2"><li>You do not have permission to access this page. Perhaps you are trying to access the content management system of this website? If you believe you should have access to this page, please contact <a href="mailto:members@justforwebmasters.com">member services</a>.</li></font>
</ol></td>
</tr>
<form action="<?php echo($PHP_SELF); ?>" method="post">
<tr>
<td bgcolor="<?php echo($row2back); ?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="33%" align="center"><font size="2"><b>Your Username: </b></font></td>
<td width="33%" align="center"><input type="text" name="uid" size="16"></td>
<td width="33%" align="center" nowrap><font size="1"> <a href="/users/register.php"><b>How to Register</b></a></font></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="<?php echo($row1back); ?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="33%" align="center"><font size="2"><b>Your Password: </b></font></td>
<td width="33%" align="center"><input type="password" name="pwd" size="16"></td>
<td width="33%" align="center" nowrap><font size="1"> <a href="/users/password.php"><b>Password Retrieval</b></a></font></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="<?php echo($row2back); ?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center" colspan="3" align="right"><input type="submit" name="submitok" value=" Log In "></td>
</tr>
</table></td>
</tr>
</form>
</table>
<?php
include('includes/footer.html');
?>
</html>
<?php
}
?>
Any ideas as to what could be causing this?
Thanks,
-Corbb
__________________
Sincerely,
Corbb O'Connor, Author at DevArticles
|