MySQL Forums
Forum List  »  PHP

Admin problem - PLEASE HELP!!!
Posted by: Refon Miah
Date: December 09, 2005 06:38PM

Hi. I am using PHP5 and MySQL5, running on Apache Server on Windows XP (on my home PC). I am trying to use the script below to create administration facility, but i get the following error message:

'You are not authorized to enter the administration area.'

Below are the scripts i am using:
(admin.php)
===============================================
<?php
// include function files for this application
require_once('part_sc_fns.php');
session_start();

if ($_POST['username'] && $_POST['password'])
// they have just tried logging in
{

$username = $_POST['username'];
$password = $_POST['password'];

if (login($username, $password))
{
// if they are in the database register the user id
$_SESSION['admin_user'] = $username;
}

else
{
// unsuccessful login
do_html_header('Problem:');
echo 'You could not be logged in.
You must be logged in to view this page.<br />';
do_html_url('login.php', 'Login');
do_html_footer();
exit;
}
}

do_html_header('Administration');
if (check_admin_user())
display_admin_menu();
else
echo 'You are not authorized to enter the administration area.';
do_html_footer();
?>
==================================================

(user_auth_fns.php)
==================================================
<?php

function check_admin_user()
// see if somebody is logged in and notify them if not
{
if (isset($_SESSION['admin_user']))
return true;
else
return false;
}

?>
==================================================

Please help me...i'm really stuck.
Cheers!!!

Options: ReplyQuote


Subject
Written By
Posted
Admin problem - PLEASE HELP!!!
December 09, 2005 06:38PM
December 12, 2005 06:39PM
December 15, 2005 05:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.