Jump to content

[SOLVED] A little help for a PHP complete newbie.


lynks

Recommended Posts

:-[ Hi everyone, I searched for a PHP code I needed and came cross a 3rd party code, problem is I keep getting the "syntax error, unexpected T_VARIABLE" on line #4 Below is the code. Since I don't know much about PHP, here's what I did. I copied the code below and made it a file like 'Thankyou.php',

Then I inseted the code on the top of the actual "thankyou" page so that the pages goes to get Thankyou.php, cheech, I don't know what I'm doing??..lol.. But here is what the third party instruction were. Thanks much, this would really help..

 

From the 3rd parties comments:

 

So this basically checks to make sure the person visiting the thank you page is coming from vendor’s site after making a purchase.  If they aren’t you redirect them to another page.  Place this code in the very beginning of your thank you page, before any html.

 

<?php // thankyou.php

function cbValid($rcpt, $time, $item, $cbpop){

$key=’ABCDE’;

$xxpop=sha1(”$key|$rcpt|$time|$item”);

$xxpop=strtoupper(substr($xxpop,0,8));

if ($cbpop==$xxpop){

return 1;

} else {

return 0;

}

}

// ===== Sanitize the input (only allow GET for security) =====

$rcpt = trim(addslashes($_GET['cbreceipt]));

$time = trim(addslashes($_GET['time']));

$item = trim(addslashes($_GET['item']));

$cbpop = trim(addslashes($_GET['cbpop']));

// ===== Redirect if invalid and exit =====

if (!cbValid($rcpt, $time, $item, $cbpop)) {

// redirect

header (”Location: http://www.SendThemSomewhere.com/“);

exit;

}

// no need to do an ELSE because the exit will terminate further processing

// if a valid transaction is not confirmed

// now have the thank you page html

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.