PDA

View Full Version : Help with a hack


pgowder
01-04-2002, 07:49 PM
I'm creating an addition to my vbulletin.

I'm getting this error:

Warning: Cannot add header information - headers already sent by (output started at /home/sites/home/web/gathering/pw_event_whois.php:3) in /home/sites/home/web/gathering/admin/functions.php on line 1490


Here is the code:

<?
require('global.php');

if ($bbuserinfo[userid]==0) {

//Send user to the registration page
show_nopermission();
} else {

//Enter the username into pw_whois


mysql_query("insert into pw_whois (eventid, username, userid) values ('7', '$bbuserinfo[username]', '$bbuserinfo[userid]')");


//Send the user back to the calendar


echo ("<html><body onload=document.location.href='http://www.powwows.com/gathering/pw_calendar/pw_event_display.php?eventid=7'></body></html>");

}
?>

Thanks

amykhar
01-04-2002, 07:53 PM
Two things to check:

a) make sure there are no blanks after the closing > at the end of the file.

b) set your cookie domain in your control panel. I have no idea why this has an effect, but it has worked for others.

Amy

pgowder
01-04-2002, 08:00 PM
How do I set the cookie domain?? What should it be set to??

Simon Moon
01-05-2002, 11:37 PM
Little hint, use the stuff from vB to access the DB. Makes your life easier :)

pgowder
01-06-2002, 01:39 AM
I'm using global??? What else can I use??

Simon Moon
01-06-2002, 02:04 AM
Well, there are 2 things specially i dont like in that thing :)

mysql_query("insert into pw_whois (eventid, username, userid) values ('7', '$bbuserinfo[username]', '$bbuserinfo[userid]')");

//Send the user back to the calendar

echo ("<html><body onload=document.location.href='http://www.powwows.com/gathering/pw_calendar/pw_event_display.php?eventid=7'></body></html>");

You can make thse 2 nicer if you FIRST use the database class of the board and SECOND if you redirect by header (wich is smother).

Would look like this for your example:
$DB_site->query("insert into pw_whois (eventid, username, userid) values ('7', '$bbuserinfo[username]', '$bbuserinfo[userid]')");

//Send the user back to the calendar

header ("Location: http://www.powwows.com/gathering/pw_calendar/pw_event_display.php?eventid=7");
But i would not do a full url in these scripts, make it more variable, this saves you headaches. Feel free to copy paste this.
The reason to use the class is, that you use the data from the class AND use the same error reporting tools. If something happens, you get informed...

pgowder
01-06-2002, 03:38 AM
I tried to use the headers, but I got errors about headers already being set. I'll change the other part.

Thanks

pgowder
01-22-2002, 03:26 PM
I'm still having problems with the cannot set headers error:

Warning: Cannot add header information - headers already sent by (output started at /home/sites/home/web/gathering/pw_event_whois.php:3) in /home/sites/home/web/gathering/admin/functions.php on line 1490

Any ideas??

pgowder
01-29-2002, 01:52 PM
Can someone help??

Why do I get this header error?