.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   PHP Header Help (http://forums.bots-united.com/showthread.php?t=3357)

biohazerd87 08-01-2005 02:27

PHP Header Help
 
ok on some forms i have after you submit it uses the function header... but it won't work. When you submit the form it just refreshes the page istead of going to the header loction. Is there some setting on the PHP itself that you can change to make the header function work?

sPlOrYgOn 08-01-2005 03:49

Re: PHP Header Help
 
the function must be runned before the headers are sent..
so it must be runned very early in the script..

biohazerd87 08-01-2005 03:52

Re: PHP Header Help
 
ok i beleive you but it worked before the servers went down and when they came back up it didn't work... lemme try moving it up futher hang on

[EDIT] No that didn't work, also i am not talking about headers i am talking about header[/EDIT]

Pierre-Marie Baty 08-01-2005 05:48

Re: PHP Header Help
 
can you post your code ? usually when something's wrong it's much easier for people to spot out bugs when they see the code.

biohazerd87 08-01-2005 06:45

Re: PHP Header Help
 
note this is the action page
PHP Code:

<?php 
/* Step One Code */ 
$name $_POST['name']; // The name field 
$email $_POST['email']; // The email field
$bot $_POST['bot']; // Bot name
$maps $_POST['maps']; // maps to waypoint 
$message $_POST['msg']; // The name field
$subject $_POST['subject']; // The Subject Field
$submit $_POST['Submit']; // submit button. Will be used for security later. 
if(isset($submit)){ 
/* Step Two Code */ 
// Sends the email to an email depending on choice of bot
if ($bot=="csb"){
$to "commonbullet@yahoo.com";
} else {
$to "wpbotsunited@gmail.com";
}
// Get their IP address 
$ip $_SERVER['REMOTE_ADDR'];
 
// Time and date of request 
$date date("j-m-Y H:i:s"); // This will get the date in the format: 5-7-2004 10:10:26 
$msg "Site Generated Email\n:::::::::::Waypoint Request:::::::::::\n\nName: $name\nEmail: $email\nBot: $bot\nIP Address: $ip\nTime and date sent: $date\n\nMaps:\n$Maps\n\nMessage:\n$message\n\nBOT LABEL CODE:\npb = PODbot mm\njb = JoeBot\ncsb = CSBot\nrb = Realbot\nsb = Shrikebot\nhpbb = HPBBot\nrcb = RCBot";
//$subject = "Waypoint Request";// no subject for gmail :)
$headers "From: Waypoints-United"// Will set the from address to whoever is emailing you. 
/* Step Three Code */ 
mail($to$subject$msg$headers); 
/* Step Four Code */ 
//Header AKA thanks page and info on request
header ("Location: http://lan.crazymonkeycomputers.com/rt.htm");

?>


BAStumm 21-01-2005 23:12

Re: PHP Header Help
 
http://us3.php.net/register_globals

php.net is your friend, use it.

FrostyCoolSlug 11-04-2005 05:23

Re: PHP Header Help
 
register_globals is also a great way of making PHP Scripts exploitable :/

PHP Code:

if(isset($submit)){ 

a better way of doing this, would be:

PHP Code:

if (!empty($_POST)) { 

Other than that, looks ok.. but..
always make sure you die(); after your HTTP headers are sent, this stops PHP sending output which will then make the header ignored by browsers (I've hit this problem before ;)) So:

PHP Code:

header("Location: http://lan.crazymonkeycomputers.com/rt.htm");
die();


(You also have a space after your header call, this could also cause problems.)

Ancient 16-01-2006 06:03

Re: PHP Header Help
 
Thanks for the stuff man works great, it is on my hosting upgrade stuff.

Thank you very much.

biohazerd87 16-01-2006 06:32

Re: PHP Header Help
 
Glad we could help :rockon:


All times are GMT +2. The time now is 11:52.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.