I have this code :
Code:
/*FILE 1*/
include("authenthicate_login.inc.php");
if( !authenthicate_login($_SERVER['PHP_AUTH_USER'],md5($_SERVER['PHP_AUTH_PW']))){
header("Location: ../login.php");
exit;
}
else
{
<table>
<td style="font-size: 10px">
<?php include("submit_form.inc.php") ?>
</td>
<td>
<?php include("query.inc.php")?>
</td>
<td>
<?php include("select_query.inc.php") ?>
</td>
</tbody>
</table>
Now to prevent people from going directly to the "submit_form.inc.php" file and the other files (without logging in) I start the ("submit_form.inc.php") code with the following:
Code:
/*FILE 2 submit_form.inc.php*/
include("authenthicate_login.inc.php");
if( !authenthicate_login($_SERVER['PHP_AUTH_USER'],md5($_SERVER['PHP_AUTH_PW']))){
header("Location: login.php");
exit;
}
else
{
/** LOAD PAGE, BECAUSE THE USER AS LOGGED IN **/
}
NOTE : that the
But I keep getting this error :
Fatal error: Cannot redeclare authenthicate_login() (previously declared in c:\apache\htdocs\folder\subfolder\authenthicate_lo gin.inc.php:25) in c:\apache\htdocs\folder\subfolder\authenthicate_lo gin.inc.php on line 25
On line 25 I have ;
function authenthicate_login($user_name_entered,$hash_of_pa ssword_entered){
.
.
.
}
I think the error is pretty self explanatory....but how do I get around this error....? Is there a way to "globalize" functions and use them thoughout my various scripts without having to include them ?
If I remove the include from FILE 2 (i.e submit_form.inc.php) I will be able to go ahead (i.e assuming that I went through the normal login process)...however the user will B able to simply enter the address of this page (i.e submit_form.inc.php) and get there with no authenthication....they will however get this error !
Fatal error: Call to undefined function: authenthicate_login() in c:\apache\htdocs\folder\subfolder\submit_form.inc. php on line 72
On line 72 (as expected) I have :
if( !authenthicate_login($_SERVER['PHP_AUTH_USER'],md5($_SERVER['PHP_AUTH_PW']))){
header("Location: login.php");
exit;
}