New Here, but have a valid header call problem.
Moderator: General Moderators
New Here, but have a valid header call problem.
Hi Everyone,
Ok Im new on this board but I have searched the net for 2 weeks for this answer. I installed a module for my phpnuke website. Ill keep this short. Its a self contained module, has its own authenticate files and process and heres the problem:
Everything in the module works 100% EXCEPT the superuser or admin access. The error recieved is header already sent by blah blah yadda yadda. I have checked all the files involved and only see one header call in the index file of the module. Where else or what else, should I be looking for?
I have tried everything imaginable under the sun, other people say the program works for them, EXCEPT MINE. I know this sounds stupid and is probably a simple dumb problem, but I cant find or solve it.
So thanks in advance and I hope someone can give me a hand on this one.
Ok Im new on this board but I have searched the net for 2 weeks for this answer. I installed a module for my phpnuke website. Ill keep this short. Its a self contained module, has its own authenticate files and process and heres the problem:
Everything in the module works 100% EXCEPT the superuser or admin access. The error recieved is header already sent by blah blah yadda yadda. I have checked all the files involved and only see one header call in the index file of the module. Where else or what else, should I be looking for?
I have tried everything imaginable under the sun, other people say the program works for them, EXCEPT MINE. I know this sounds stupid and is probably a simple dumb problem, but I cant find or solve it.
So thanks in advance and I hope someone can give me a hand on this one.
have you read this? http://www.devnetwork.net/forums/viewtopic.php?t=1157
Hi Volka,
Thank you for that quick response. I did follow what the article had said. But however, either Im doing something wrong, or the original module sequences or code is wrong. Im going to post here what I have, maybe its obvious to you, but 14 days I still cant see it.
In the original admin.php file the top lines call the header as seen here:
Now begins the login process in the same file:
Ok now we go to the functions.php next (I think) making a call to this function, no header info on the top of page, its all functions:
And within the process, it calls the authenticate.php file for this:
The config.php file is configured properly as everything else runs perfectly. But when you try to login as an admin, you get this error:
Warning: Cannot add header information - headers already sent by (output started at /usr/local/apache/htdocs/modules/themodule/authenticate.php:2) in /usr/local/apache/htdocs/modules/themodule/functions.php on line 206
Line 206 is the first set cookie call in functions.php.
As I said, I tried everything I could think of using similar scripting from that article, other modules, books, etc. Im so stuck and re-read this so many times, I think even if I could, I couldn't find it from being burned out. Thanks in advance.
Und Volka, Vielen Danke, Ich Mochtegern sprechen Deutsch, jedoch mein Deutsch ist nicht gut.
Thank you for that quick response. I did follow what the article had said. But however, either Im doing something wrong, or the original module sequences or code is wrong. Im going to post here what I have, maybe its obvious to you, but 14 days I still cant see it.
In the original admin.php file the top lines call the header as seen here:
Code: Select all
if (!eregi("modules.php", $PHP_SELF))
{
die ("You can't access this file directly...");
}
$ModName = basename(dirname(__FILE__));
include("header.php");Code: Select all
include("./modules/$ModName/config.php");
include("./modules/$ModName/functions.php");
employment_language();
// check user is logged in
if (verify_session($authok) == "FALSE")
{
OpenTable();
echo "<a href=$ModuleBaseUrl=post&create_login=true>create an account</a> | ";
echo "<a href=$ModuleBaseUrl=post&login=true>login</a><br><br>";
$user_id = verify_session($authok);
// this lets you display login box or create login box
if ($login == "true")
{
draw_login_box("Login Here", "200", $ModuleDirName);
}
if ($create_login == "true")
{
draw_create_login_box("Create Login Here", "200", $ModuleDirName);
}
CloseTable();
exit;
}
else
{//start of login code
OpenTable();
$user_id = verify_session($authok);Code: Select all
function init_session ($name)
{
setcookie ("authok", $name ,time()+3600, "/", '', 0);
}
function kill_session()
{
setcookie ("authok", "",time()-3600, "/", '', 0);
}Code: Select all
include("config.php");
include("functions.php");
if ($logout == "true")
{
kill_session($hostname);
redirect($login_success);
}
else
{
$link = mysql_connect($hostname, $user, $pass) or die("Could not connect");
mysql_select_db($database) or die("Could not select database");
$result = mysql_query("SELECT * FROM {$prefix}_jobaccounts WHERE user='$UserName'");
$row_array = mysql_fetch_array($result);Warning: Cannot add header information - headers already sent by (output started at /usr/local/apache/htdocs/modules/themodule/authenticate.php:2) in /usr/local/apache/htdocs/modules/themodule/functions.php on line 206
Line 206 is the first set cookie call in functions.php.
As I said, I tried everything I could think of using similar scripting from that article, other modules, books, etc. Im so stuck and re-read this so many times, I think even if I could, I couldn't find it from being burned out. Thanks in advance.
Und Volka, Vielen Danke, Ich Mochtegern sprechen Deutsch, jedoch mein Deutsch ist nicht gut.
Hi Martin,
Thanks! I just tried it however, and it said you cannot access this file directly. Most PhpNuke modules have that form of security on them. But I'll try anything to get it workingsince its the module that will be the core of the site design. I have built all around it and Im so frustrated because Its the one module everyone seeks when visiting. I used to use his previous version which had no authentication process and the admin had to post everything, but with this one, they can maintain their own posts. So you can see my frustration level here.
Thanks! I just tried it however, and it said you cannot access this file directly. Most PhpNuke modules have that form of security on them. But I'll try anything to get it workingsince its the module that will be the core of the site design. I have built all around it and Im so frustrated because Its the one module everyone seeks when visiting. I used to use his previous version which had no authentication process and the admin had to post everything, but with this one, they can maintain their own posts. So you can see my frustration level here.
If nothing else helps and you can't find the (probably whitespace only) output before header information is sent you may use ob_start or enable output_buffering in your php.ini
p.s. I think your german and my english are on equal terms. As long as you can bear it, I'd prefer to stay on english
p.s. I think your german and my english are on equal terms. As long as you can bear it, I'd prefer to stay on english
Code: Select all
function init_session ($name)
{
setcookie ("authok", $name ,time()+3600, "/", '', 0);
}
function kill_session()
{
setcookie ("authok", "",time()-3600, "/", '', 0);
}
function verify_session ($md5)
{
$ModName = basename(dirname(__FILE__));
include("./modules/$ModName/config.php");
mysql_connect($hostname, $user, $pass) or die("Could not connect");
mysql_select_db($database) or die("Could not select database");
$result = mysql_query("SELECT * FROM {$prefix}_jobaccounts WHERE md5='$md5'");
$row_array = mysql_fetch_array($result);
if ($row_arrayї0] != "")
{
return $row_arrayї0];
}
else
{
return "FALSE";
}
}
function redirect ($url)
{
echo "<SCRIPT LANGUAGE='JavaScript'>";
echo "document.location.href='$url'";
echo "</SCRIPT>";
exit;
}
?>Told ya it was wierd.
Thats my sentiments exactly, so here is the entire script for the authenticate.php file:
I have frustration blindness, so no errors appear to me in the script. For me, its an Enigma!
Code: Select all
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
//goes to this file after you login to check if you are a valid user
include("config.php");
include("functions.php");
if ($logout == "true")
{
kill_session($hostname);
redirect($login_success);
}
else
{
$link = mysql_connect($hostname, $user, $pass) or die("Could not connect");
mysql_select_db($database) or die("Could not select database");
$result = mysql_query("SELECT * FROM {$prefix}_jobaccounts WHERE user='$UserName'");
$row_array = mysql_fetch_array($result);
if ($row_arrayї0] == "")
{
redirect("$redirect_error&error=7");
}
else
{
$Password = substr(md5("phpcryptcamp".$Password),0,10);
if ($Password != $row_arrayї1])
{
redirect("$redirect_error&error=8");
}
else
{
init_session($row_arrayї3]);
mysql_query("UPDATE {$prefix}_jobaccounts SET count=count+1 WHERE {$prefix}_jobaccounts.user = '$UserName'");
redirect($login_success);
}
}
}
?>I have frustration blindness, so no errors appear to me in the script. For me, its an Enigma!
that's output.
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
even
Code: Select all
<?php ...Everything you can see and/or select, when you open "view-source" in your browser, is output.
Oh A duh!!!
Yes Im retarded to completely forget about that. Its called phprofession. Its an employment module originally designed for PostNuke, but a version for phpNuke has been created. To see it in action heres the link to the website along with download links.
http://www.phpsolutions.co.uk
As a reminder, I use PhpNuke.
Sorry about that Volka. My brain has been fried pretty bad from this. I dreamed in code all night last night,
http://www.phpsolutions.co.uk
As a reminder, I use PhpNuke.
Sorry about that Volka. My brain has been fried pretty bad from this. I dreamed in code all night last night,
hmmm...I know you don't want to hear it, but I just downloaded phpnuke5.6 (wahhhhh.....had to turn register_globals on
) and installed phprofession2.4PL-beta (also I blew it the first time. sorry config.php, haven't installed nuke in document-root
) and it's working as far as I can see.
It floods my apache error.log with php-notices but not with header-information problems.
But the javascripts make my InterDev wimmering. To enter the responsibilities is nearly impossible because on any char typed an error-message pops up ;(
It floods my apache error.log with php-notices but not with header-information problems.
But the javascripts make my InterDev wimmering. To enter the responsibilities is nearly impossible because on any char typed an error-message pops up ;(
Volka,
I just got the answer. chatted with the developer, it was the stupid line:
Needed to be removed from ALL files.
I knew this was going to be a dumb answer, but that was the solution. Im sorry to hear that you had a rough time with 5.6. Supposedly it was better than 5.5, i use 5.5. Been working like a charm.
I just got the answer. chatted with the developer, it was the stupid line:
Code: Select all
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">I knew this was going to be a dumb answer, but that was the solution. Im sorry to hear that you had a rough time with 5.6. Supposedly it was better than 5.5, i use 5.5. Been working like a charm.