lynks Posted October 17, 2008 Share Posted October 17, 2008 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,); 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/128916-solved-a-little-help-for-a-php-complete-newbie/ 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.