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

?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.