Jump to content


Photo

header redirection prob


  • Please log in to reply
7 replies to this topic

#1 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 22 May 2006 - 09:47 PM

Hello Everyone!

First off, big thanks to everyone who's helped me in the past. I haven't had to post a question for almost half a year!

But now I'm having a retarded problem with something simple.

I have a signup script on my site. The data is collected, analyzed, verified, transformed, transmitted, stored, and everything that happens to user input. So, I have the data just the way I want, stored in a database; I write a nice email to the new user with the message in $message, and the return email address in the $headers var (no user input is stored in the header var). Here is the code at the point in question.

$success = mail($emailTo, $subject, $message, $headers);

header("Location: http://www.ebay.com");
die();

I receive the email perfectly, every time, just as expected, but then the browser stops at a blank screen. I used ebay as a pointer so I can see if it is working. The Browser is not redirected. I've tried changing die(); to exit(); and still no good.

I'm slightly confused. I've set up header redirects before but this one doesn't work. It seems that if the script is running fine, sending emails, storing data and everything else, the syntax is ok up to this point.

Am I missing something dumb? or am I just dumb?

Thanks much for the help!

Daniel

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 22 May 2006 - 09:57 PM

well here's a possibly dumb answer to a possibly dumb question :)

maybe ebay has some kind of "block" of some kind? I only know the basics of the header function so I don't know if that is possible. But, maybe it is? Have you tried putting in some other url, like say, to another page in your own site?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 22 May 2006 - 10:03 PM

[!--quoteo(post=376167:date=May 22 2006, 03:57 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 22 2006, 03:57 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
maybe ebay has some kind of "block" of some kind?[/quote]

Brilliant Idea! But it still didn't work :( I thought that would do the trick, as before that I tried only paths (/accounts/home or ../index.php) but even the full http url to my home page didn't work.

And before anyone asks, yes, I did lots of searches, I read the 'Read me first if you have header problems' thread right above this post :) and I tried the things I found, but still no redir. I'm hesitant to post the script as it is about 20k, but I will if its requested.

Thanks so far!

Dan

#4 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 22 May 2006 - 10:24 PM

Gah, I'm so confused

Here's the code now:

$success = mail($emailTo, $subject, $message, $headers);

echo "I'm going to forward right now";

header("Location: http://www.personalizedhomepage.com");
die();

echo "You can't see me";

And when I run it I get a blank page with "I'm going to forward right no" in the corner. Not even a headers already sent error. The last line of course doesn't show up cus the script hits the die();. So, the line before and after the header line run fine, but the header line doesn't seem to.

Any suggestions would be lovely!

Daniel

#5 Houdini

Houdini
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 22 May 2006 - 10:26 PM

Does it even produce an error? Or even worse does the code echo You can't see me.?
We the unwilling, led by the unknowing,
have done so much, for so long, with so little,
that we are now quqlified to do anything, with nothing!

#6 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 22 May 2006 - 10:30 PM

[!--quoteo(post=376170:date=May 22 2006, 04:26 PM:name=Houdini)--][div class=\'quotetop\']QUOTE(Houdini @ May 22 2006, 04:26 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Does it even produce an error? Or even worse does the code echo You can't see me.?
[/quote]

Hee hee, No. No error whatsoever. I was expecting a "headers already sent" error when I ran this but I can't even code in an error right I guess. And No, lol, thankfully "You can't see me" doesn't appear.

I just have a blank page with "I'm going to forward right now" in the top left corner.

Thanks!

Dan

#7 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 22 May 2006 - 10:43 PM

Once again I've wasted peoples time and this servers forum space.

Well, hopefully someone else will learn from my dumb mistake.

Ok, I copied the header line to the top of the signup page. Right after the <?PHP.

Viola, worked perfectly.

I moved it to right under my require('DBConnection script url'); line and no worky.

So, checked included file and there was a blank line above the <?PHP.

I feel like I should be banned from forums as this happened last time I posted too, something dumb was all that was wrong.

Ah, well, I suppose someday I'll outgrow these dumb mistakes, or at least a few of em.

Thanks much to all you who helped!

Daniel

---I do wonder why I didn't get a 'headers already sent' error... Hmm.... ---

#8 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 22 May 2006 - 11:33 PM

you didn't get that error because....idk i'm dumb too [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users