Jump to content

can anyone help me please


Recommended Posts

i am trying to run this script and i get this error message

:" Fatal error: Call to undefined function admin_check() in C:\Program Files\xampp\htdocs\bpo\admin\newscategory.php on line 6

here the script :"

<?php
include $_SERVER['DOCUMENT_ROOT'].
'/bpo/layout.php';

// Quick Admin session check
[b] this is line 6-->[/b] admin_check();

switch($_REQUEST['req']){
// Category Insert Case
case "create_cat":
myheader("Add News Category");

// Double check form posted values are there
// before performing INSERT query
if(!$_POST['cat_name'] || !$_POST['cat_description']){
echo '<p align="center">Missing Form Information!</p>'.
'<p align="center">Please use your browser back '.
'button and complete the form.</p>';
footer();
exit();
}

// Insert Query
$sql = mysql_query("INSERT INTO news_categories
(cat_name, cat_description)
VALUES('{$_POST['cat_name']}',
'{$_POST['cat_description']}')");

// Insert query results
if(!$sql){
echo "Error with MySQL Query: ".mysql_error();
} else {

echo '<p align="center">Category '.$_POST[cat_name].
' created!<br />New category id: '.mysql_insert_id();
echo '<br /><a href="/bpo/admin/newscategory.php?req=new_cat">Create '.
'another category</a>';
}
break;

// Create category form case
case "new_cat":
myheader("Create News Category");
include $_SERVER['DOCUMENT_ROOT'].
'/bpo/html/forms/news_category_insert.html';
footer();
break;

default:
myheader("News Category Administration");
include $_SERVER['DOCUMENT_ROOT'].
'/bpo/html/news_cat_admin.html';
footer();
break;

}
?>


so can anyone help me here thx in advance ,
Link to comment
Share on other sites

[!--quoteo(post=361012:date=Apr 2 2006, 05:35 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ Apr 2 2006, 05:35 PM) [snapback]361012[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you are missing the function called "admin_check()", should be decleared above the request for it or in a included script.
[/quote]


thx for your reply , the function " admin_check(); is defined here in my session.php
:
:
<?php
session_start();
session_name( 'MyPHPSite' );
header( "Cache-conrol : private"); // Fix for IE
function login_check(){
if($_SESSION['login'] != TRUE ){
myheader("Login Required!");
include $_SERVER['DOCUMENT_ROOT'].
'/bpo/html/forms/login_form.html';

footer();
exit();
}
}
function admin_check(){
if($_SESSION['admin_access']{
myheader("Access Denied!")
echo "<center>This Area is Restricted".
" For Website Administrators!";
footer();
exit();
}
}
?>
Link to comment
Share on other sites

then you must include or rather require session.php in your script, like this - assuming the same path:
[code]
<?php
require $_SERVER['DOCUMENT_ROOT'].'/bpo/session.php';
include $_SERVER['DOCUMENT_ROOT'].'/bpo/layout.php';

// Quick Admin session check
admin_check();

// bla bla, script goes on

?>
[/code]
Link to comment
Share on other sites

[!--quoteo(post=361015:date=Apr 2 2006, 05:47 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ Apr 2 2006, 05:47 PM) [snapback]361015[/snapback][/div][div class=\'quotemain\'][!--quotec--]
then you must include or rather require session.php in your script, like this - assuming the same path:
[code]
<?php
require $_SERVER['DOCUMENT_ROOT'].'/bpo/session.php';
include $_SERVER['DOCUMENT_ROOT'].'/bpo/layout.php';

// Quick Admin session check
admin_check();

// bla bla, script goes on

?>
[/code]
[/quote]
thx i fix that part , when i run the script now i got this error now : Parse error: syntax error, unexpected T_ECHO in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 18

if(!$_POST['cat_name'] || !$_POST['cat_description']){
echo '<p align="center">Missing Form Information!</p>'.
[b] line 18 is ---> [/b]'<p align="center">Please use your browser back button and complete the form.</p>';

i am working on it , but if you can help that will be nice ,
Link to comment
Share on other sites

[!--quoteo(post=361019:date=Apr 2 2006, 05:55 PM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Apr 2 2006, 05:55 PM) [snapback]361019[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thx i fix that part , when i run the script now i got this error now : Parse error: syntax error, unexpected T_ECHO in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 18

if(!$_POST['cat_name'] || !$_POST['cat_description']){
echo '<p align="center">Missing Form Information!</p>'.
[b] line 18 is ---> [/b]'<p align="center">Please use your browser back button and complete the form.</p>';

i am working on it , but if you can help that will be nice ,
[/quote]

Any help guys , seems i can found the error , please help thx , i am waitng for some of your reply thx again

[b]Error[/b] :Parse error: syntax error, unexpected T_ECHO in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 18
Link to comment
Share on other sites

Try
[code]
if(!$_POST['cat_name'] || !$_POST['cat_description']){
echo "<p align='center'>Missing Form Information!</p><br>
<p align='center'>Please use your browser back button and complete the form.</p>";
[/code]
Link to comment
Share on other sites

[!--quoteo(post=361029:date=Apr 2 2006, 06:17 PM:name=Seanyboy)--][div class=\'quotetop\']QUOTE(Seanyboy @ Apr 2 2006, 06:17 PM) [snapback]361029[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try
[code]
if(!$_POST['cat_name'] || !$_POST['cat_description']){
echo "<p align='center'>Missing Form Information!</p><br>
<p align='center'>Please use your browser back button and complete the form.</p>";
[/code]
[/quote]

[i]thx very much it work now , but look at the error message i get on top of the page , can someone tell me why i am getting it , thx very much , you guys are very helpfull , but look at this error message [/i][u]

[b]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\xampp\htdocs\bpo\classes\clsMetaContent.php:45) in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\xampp\htdocs\bpo\classes\clsMetaContent.php:45) in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\htdocs\bpo\classes\clsMetaContent.php:45) in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 4
[/b]
Link to comment
Share on other sites

this just means your sessions are already started from one of the pages session.php or layout.php and can not be started again
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\xampp\htdocs\bpo\classes\clsMetaContent.php:45) in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 2[/quote]

place this at the top of your page it will stop your page from showing the warning or notice errors

[code]
<? error_reporting(E_ERROR);?>
[/code][
Link to comment
Share on other sites

if its a warning then apprentice webmaster's script wont run at all!

apprentice webmaster the error message is saying you have somethikng being outputted to the browser near/on line 45 in clsMetaContent.php

What is around line 45 in clsMetaContent.php. Could you post lines 40 - 50.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.