Need help with redirect...

Discussion in 'PHP' started by wholesalechecklist, Dec 28, 2006.

  1. #1
    This is my php code for a new form on my website. At the bottom, you can see that I want to redirect to a paypal payment page, but it redirects to a normal http instead of the https. Is there a better way to redirect so that it does go to a secure server (https)?

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','Name');
    pt_register('POST','EmailAddress');
    pt_register('POST','URL');
    pt_register('POST','URLofBanner');
    pt_register('POST','AltText');
    pt_register('POST','OtherComments');
    $OtherComments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $OtherComments);pt_register('POST','RightMenuBannerAd');
    if($Name=="" || $EmailAddress=="" || $URL=="" || $URLofBanner=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$EmailAddress)){
    $error.="<li>Invalid email address entered";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="Name: ".$Name."
    Email Address: ".$EmailAddress."
    URL: ".$URL."
    URL of Banner: ".$URLofBanner."
    Alt Text: ".$AltText."
    Other Comments: ".$OtherComments."
    Right Menu Banner Ad: ".$RightMenuBannerAd."
    ";
    $message = stripslashes($message);
    mail("my@email.com","Form Submitted at your website",$message,"From: phpFormGenerator");
    
    header("Refresh: 0;url=https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=devilzfan300%40yahoo%2ecom&item_name=Right%20Menu%20Banner%20Ad%20on%20FSW&no_shipping=1&return=http%3a%2f%2fwww%2efantasysportswiz%2ecom%2fadthankyou%2ephp&no_note=1&currency_code=USD&lc=US&bn=PP%2dSubscriptionsBF&charset=UTF%2d8&a3=30%2e00&p3=1&t3=M&src=1&sra=1");
    ?><?php 
    }
    ?>
    PHP:

     
    wholesalechecklist, Dec 28, 2006 IP
  2. wholesalechecklist

    wholesalechecklist Peon

    Messages:
    511
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Fixed: just needed an extra space in there.

    /thread
     
    wholesalechecklist, Dec 28, 2006 IP
  3. baddot

    baddot Active Member

    Messages:
    309
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #3
    erm why dont you use

    header location to redirect ?
     
    baddot, Dec 28, 2006 IP