Free2Code
 
Time: 2008-12-04, 07:39pm
What type of Request is this?
Subject: What type of Request is this?  ·  Posted: 2007-05-19, 12:10am
Rank: ? (1)
Member #: 29621
I'm a PHP PROGRAMMER & I HAVE THIS FILE IN ASP.
I WANT TO REWRITE IT IN PHP..
I'm TRYING TO UNDERSTAND THIS CODE

---------------------------------------------------

PaymentID = Request("paymentid")
ResultCode = Request("result")
AuthCode = Request("auth")
TranID = Request("tranid")
PostDate = Request("postdate")
TrackID = Request("trackid")

Response.Write("REDIRECT=http://www.domain.com/receipt.php?PaymentID=" & PaymentID)

------------------------------------------------

Is it GET REQUEST?
CAN ANYONE REWRITE THIS SMALL CODE IN PHP?

----------------------
THIS IS MY REWRITING BUT I DON'T KNOW IT IT IS CORRECT




if (isset ($_GET['paymentid'])) { $PaymentID = $_GET['paymentid']; }
if (isset ($_GET['result'])) { $ResultCode = $_GET['result']; }
if (isset ($_GET['auth'])) { $AuthCode = $_GET['auth']; }
if (isset ($_GET['tranid'])) { $TranID = $_GET['tranid']; }
if (isset ($_GET['postdate'])) { $PostDate = $_GET['postdate']; }
if (isset ($_GET['trackid'])) { $TrackID = $_GET['trackid']; }

//---------------------------------------------------------------
if (isset ($_GET['paymentid'])) {

print "<meta http-equiv='refresh' content='0; url='http://www.domain.com/receipt.php?PaymentID=$PaymentID'>";

}
//---------------------------------------------------------------


» Post edited 2007-05-19, 12:11am by ameenov.

 
  Reply to this ·  Post link ·  Top
Subject: Re: What type of Request is this?  ·  Posted: 2007-05-19, 01:17pm
Rank: ? (767)
Member #: 11085
First and foremost, take your left pinky finger, move it over about half an inch, and press down. I can't truly be of much use to you other than that; however, you shouldn't take that piece of advice for granted, I guarantee its value far surpasses its appearance.

I have never used ASP myself; however, by all assumptions, your translation seems correct. You only stated that you don't know if it is correct, so I have to assume you haven't tried it yet, or else you would likely be more decisive. In any case, if what you have isn't correct, I would suggest $_POST, as that is the other, equally likely, option.


» Post edited 2007-05-19, 01:20pm by relpats_eht.

- relpats_eht
 
  Reply to this ·  Post link ·  Top
Subject: Re: What type of Request is this?  ·  Posted: 2007-05-21, 07:00am
Rank: ? (4821)
Member #: 3416
the Repsonse.Write code doesn't seem quite right, since that's not the right--looks like it's just going to print that text on the page.

if you really want to do a redirect in php though, you should use header('Location: http://www.domain.com/receipt.php?PaymentID=' . $PaymentID);

meta tags with http-equiv should really only be used when you aren't able to send the appropriate headers. with php, you can always send the appropriate headers.

my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
 
  Reply to this ·  Post link ·  Top
Subject: Re: What type of Request is this?  ·  Posted: 2007-05-21, 07:45am
Rank: ? (767)
Member #: 11085
misterhaan writes...
with php, you can always send the appropriate headers.
Don't lie now, misterhaan. There was a time when every other day I would find myself telling people quite the contrary. You can only send headers if no data has been outputted yet, making output buffering the easiest solution to that problem.

- relpats_eht
 
  Reply to this ·  Post link ·  Top
Subject: Re: What type of Request is this?  ·  Posted: 2007-05-22, 03:08am
Rank: ? (4821)
Member #: 3416
you can always send the appropriate headers -- you just have to do it the right way ;)

» Post edited 2007-05-22, 03:08am by misterhaan.

my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
 
  Reply to this ·  Post link ·  Top
Subject: Re: What type of Request is this?  ·  Posted: 2007-05-22, 03:08am
Rank: ? (4821)
Member #: 3416
weird, it says post edited but i didn't edit! maybe because i unchecked the smilie box?

my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons