Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Can anyone see anything wrong with this page

    It's a free affilliate script very simple easy admin, i can get it to register referrals site visits by adding the required code to the home page, but won't register sales to affiliates account or admin area when i put sale code on thankyou page.

    here are the instructions

    5. Open your landing page where you want affiliates to send the customers to, maybe
    your home page or an order form page.
    a. Enter the following code above the <html> tag and any other code:
    include_once "your_folder/affiliate.php"; (where your_folder is the folder
    you installed sonic_affiliate
    b. Save the changes and exit the file

    6. Open your sale confirmation page and add the following line of code. This code should be
    placed in a portion of the page that is only executed when a sale is completed.
    include_once "your_folder/sale.php";
    b. Save the changes and exit the file.



    sale.php code

    <?
    ob_start();
    //get the offer info based on the offerid and the
    //break up the rid into the affiliate id and the offerid
    //write code here to do the above
    include "home/profitsh/public_html/affiliate/sa_config.php";
    list($offerID, $affiliateID) = explode("sa", $HTTP_COOKIE_VARS['saref']);
    $con = sa_db_connect();
    if(!$con){
    echo "Database error on sale.php";
    }
    //security: make sure affiliate isn't selling the wrong offer
    $q1 = "SELECT SalePHPSelf FROM Offers WHERE OfferID = '$offerID' ";
    $result1 = mysql_query($q1);
    $row1 = mysql_fetch_array($result1);
    if($row1[SalePHPSelf] != $PHP_SELF){
    //we have an affiliate sending sales from the wrong offer
    //generate a message to us
    echo "sale tracking error";
    }else{
    //we can continue the script
    // Do not edit anything below this line

    $ref = $HTTP_COOKIE_VARS["saref"];
    if ($ref == ''){
    if($debugMessage)
    echo "<br><font color=#ff0000>SonicAffiliate Debug Msg: No referrer found in cookie,
    trying to use sessions.</font><br>";
    $ref = $_SESSION["ref"];
    if($ref == '' && $debugMessage)
    echo "<br><font color=#ff0000>SonicAffiliate Debug Msg: No referrer found in session.</font><br>";
    }
    if ($ref != ''){
    if($debugMessage){
    echo "<br><font color=#ff0000>SonicAffiliate Debug Msg: Referrer '$ref' found, registering sale.</font><br>";
    }
    //break the $ref into the AffiliateUsername and the OfferID
    //get the amount of the payout
    $timeNow = date("U");
    $q1 = "SELECT PayOut, RefundDelay FROM Offers WHERE OfferID = '$offerID' ";
    $result1 = mysql_query($q1);
    $row1 = mysql_fetch_array($result1);
    $qualDate = $timeNow + $row1[RefundDelay];
    $q3 = mysql_query("SELECT UnixTime FROM Sales WHERE RemoteAddress = '$REMOTE_ADDR' AND OfferID = $offerID
    ORDER BY UnixTime desc LIMIT 1 ");
    $row3 = mysql_fetch_array($q3);
    if(mysql_num_rows($q3) > 0 && $timeNow < $row3[UnixTime] + 600){
    //do not record the sale, we should notify the admin of the attempted fraud
    //less than 10 minutes between the last sale from this IP address on this offer
    }else{
    //record the sale
    $q2 = "INSERT INTO Sales (AffiliateID, OfferID, UnixTime, QualTime, RemoteAddress)
    VALUES ('$affiliateID', '$offerID', '$timeNow', '$qualDate', '$clickIP')";
    $result2 = mysql_query($q2);
    //echo $q2;
    }
    }
    }
    ob_flush();
    ?>

  • #2
    Regular Coder
    Join Date
    Aug 2006
    Posts
    311
    Thanks
    0
    Thanked 1 Time in 1 Post
    The thing that jumps out at me is the mix of deprecated and no deprecated variables. For example you have $HTTP_COOKIE_VARS which is deprecated. You should use $_COOKIE. Try changing the variables to updated versions.

    here is the manual that talks about variables.
    http://www.php.net/manual/en/languag...predefined.php

  • Users who have thanked Jacobb123 for this post:

    jammo99 (01-05-2008)

  • #3
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    And put your code between [ PHP ] and [ / PHP ] tags!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •