Jump to content


Photo

can anyone help me please


  • Please log in to reply
10 replies to this topic

#1 the apprentice webmaster

the apprentice webmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 02 April 2006 - 10:29 PM

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
this is line 6--> 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 ,

#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 02 April 2006 - 10:35 PM

you are missing the function called "admin_check()", should be decleared above the request for it or in a included script.

#3 the apprentice webmaster

the apprentice webmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 02 April 2006 - 10:39 PM

[!--quoteo(post=361012:date=Apr 2 2006, 05:35 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ Apr 2 2006, 05:35 PM) View Post[/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();
}
}
?>


#4 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 02 April 2006 - 10:47 PM

then you must include or rather require session.php in your script, like this - assuming the same path:
<?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

?>


#5 the apprentice webmaster

the apprentice webmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 02 April 2006 - 10:55 PM

[!--quoteo(post=361015:date=Apr 2 2006, 05:47 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ Apr 2 2006, 05:47 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
then you must include or rather require session.php in your script, like this - assuming the same path:
<?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

?>
[/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>'.
line 18 is ---> '<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 ,

#6 the apprentice webmaster

the apprentice webmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 02 April 2006 - 11:10 PM

[!--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) View Post[/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>'.
line 18 is ---> '<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

Error :Parse error: syntax error, unexpected T_ECHO in C:\Program Files\xampp\htdocs\bpo\includes\session.php on line 18

#7 Mr.x

Mr.x
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 02 April 2006 - 11:17 PM

Try
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>";


#8 the apprentice webmaster

the apprentice webmaster
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 02 April 2006 - 11:23 PM

[!--quoteo(post=361029:date=Apr 2 2006, 06:17 PM:name=Seanyboy)--][div class=\'quotetop\']QUOTE(Seanyboy @ Apr 2 2006, 06:17 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try
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>";
[/quote]

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 [u]

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


#9 Mr.x

Mr.x
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 02 April 2006 - 11:30 PM

I don't have time to look at the code of the script, but a possible quick fix could be putting on line 1
<? session_start(); ?>
I'm not 100% sure.

#10 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 03 April 2006 - 08:16 AM

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

<? error_reporting(E_ERROR);?>
[
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#11 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 April 2006 - 09:27 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users