shanejeffery86 Posted August 19, 2011 Share Posted August 19, 2011 NOTE: The PHP code below is coming from the same index.php file that the 2nd header is redirecting too. Hey all. I have done a ton of research and troubleshooting on my end, so let me tell you first off what is not happening. 1. There is nothing been echo'd prior to the header. 2. The PHP tags have no space before/after them. 3. The syntax for the header parameters are correct. Here is the code block: if($_POST['register'] == "Pay & Register"){ include("../statreport/paid-content.php"); $creatorID = findBoxCreatorID($_POST['box_id']); $creatorEmail = findCreatorEmail($creatorID); $returnURL = 'http://' . $_SERVER['SERVER_NAME'] . "/"; $paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; $payment_data = array( 'cmd' => '_xclick', 'business' => $creatorEmail, 'item_name' => 'ContentBoxer Box Purchase - (User ID: ' . $user_id . ')', 'item_number' => $_POST['box_id'], 'amount' => 0.01, //$_POST['boxPrice'], 'no_shipping' => 1, 'return' => $returnURL, 'shipping' => 0, 'tax' => 0 ); $payment_data_2 = http_build_query($payment_data); header("Location: $paypal_url?$payment_data_2"); } else { setcookie("ebook_uid",$user_id,mktime() + 31556926, "$box_path"); setcookie("ebook_chk",$user_code,mktime() + 31556926, "$box_path"); //need to check that this still works...also, need to make it work when users log in and don't have basic required questions in their profile. if (!$displayallquestions) { header("location:index.php?e=".$_POST["box_id"]."&open=1"); //for 2-part registration, go to the next part. } else { $_POST["submit_questions"] = true; //for 1-part registration, set this so that we can move on to the custom questions. } } Here is the thing though. If the code executes down to header("location:index.php?e=".$_POST["box_id"]."&open=1");, this header runs perfectly fine. However, if it tries to do the external header for the Paypal link, then nothing happens. If I put in an echo right before the header redirect for Paypal, the echo gets run. Also, if I take the output of the paypal URL and paste it into the URL bar, the URL works just as it is supposed to. So, there is no issue with the paypal URL. Something is going on with the header() function in regards to redirecting to an external site. Any ideas? As I think this may be mod_rewrite based, I am going to include the htaccess file as well. Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^contentboxer.com [nc] rewriterule ^(.*)$ http://www.contentboxer.com/$1 [r=301,nc] RewriteRule ^[0-9]+/group/([_A-Za-z0-9-]+)/box/([0-9]+)/? /shelf/index.php?s=$1&e=$2 RewriteRule ^[0-9]+/group/([_A-Za-z0-9-]+)/?$ /shelf/index.php?s=$1 RewriteRule ^[0-9]+/mp/([_A-Za-z0-9-]+)/box/([0-9]+)/? /mp/index.php?s=$1&e=$2 RewriteRule ^[0-9]+/embed/([_A-Za-z0-9-]+)/([0-9]+)/? /shelf/index.php?s=$1&e=$2 RewriteRule ^[0-9]+/embed/([_A-Za-z0-9-]+)/?$ /shelf/index.php?s=$1 RewriteRule ^[0-9]+/embed/([_A-Za-z0-9-]+)/([0-9]+)/params(.*)/? /shelf/index.php?s=$1&e=$2¶m=$3 RewriteRule ^[0-9]+/embed/([_A-Za-z0-9-]+)/params(.*)/? /shelf/index.php?s=$1¶m=$2 RewriteRule ^[0-9]+/([_A-Za-z0-9-]+)/([0-9]+)/? /shelf/index.php?s=$1&e=$2 RewriteRule ^[0-9]+/([_A-Za-z0-9-]+)/?$ /shelf/index.php?s=$1 RewriteRule ^rss/[0-9]+/?([_A-Za-z0-9-]?)/?([0-9]?)/?([_A-Za-z0-9-]?)/ /rss/rss.php Quote Link to comment https://forums.phpfreaks.com/topic/245232-header-function-issues-no-redirect-happening/ Share on other sites More sharing options...
Maq Posted August 19, 2011 Share Posted August 19, 2011 Did you turn error reporting on? What's in this file? include("../statreport/paid-content.php"); Is there any output? Quote Link to comment https://forums.phpfreaks.com/topic/245232-header-function-issues-no-redirect-happening/#findComment-1259589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.