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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    Postback script GPT

    Hello, I have the following code:

    Code:
    <?
    include ("config.php");
    
    //here we will use get variables. 
    $snuid = $_GET['yti'];
    $campid = $_GET['campaignid'];
    $points = $_GET['rate'];
    $ip = $_SERVER['REMOTE_ADDR'];
    $sts = $_GET['credit'];
    
    
    if ($ip == "174.120.27.187" || "174.120.146.43" && $sts="1")
    {
    //INSERT LOGIC TO CREDIT POINTS TO USERS
    mysql_query("UPDATE members SET pokerpoints=pokerpoints+".$points." WHERE username='".$snuid."'");
    mysql_query("UPDATE members SET totalpointsearned=totalpointsearned+".$points." WHERE username='".$snuid."'");
    mysql_query("INSERT into recentpoints (message) VALUES ('$snuid has just cashed out for $rate Bankroll Bucks')");
    mysql_close();
    }
    else
    {
    	die ("query failed");
    }
    ?>
    And most of it seems to be working, except the $points. What is happening is the $point value in recentredemptions is blank, so it says
    AnimalRoam has just cashed out for Bankroll Bucks
    and it is not awarding any points. What i tried to do before was use PHP multiply functions to multiple the CENTS into points, then using what it outputs and multiplying that by .7 (to get 70 percent) then flooring it so if it outputs a decimal it rounds down. But after I did that it did not input anything into the recent redemptions or points.

    ALSO, how would i make it so when it goes in to look for the username in members, how woulc I make it so its not case sensitive?

    THANKS FOR EVERYONES HELP!

  • #2
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    anyone?

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Sorry, at which point is $points empty? From the GET or within the database?
    Also, this is completely wrong:
    PHP Code:
    if ($ip == "174.120.27.187" || "174.120.146.43" && $sts="1"
    This block will always evaluate; no exceptions. This is because it will check if $ip is as compared OR that the string is valid AND the setting of $sts to 1 is true (which in these two situations is always true).

    Your actual message there is correct though. You haven't defined $rate anywhere.

    Be sure to google for 'PHP SQL injection prevention' to make sure you don't leave this open (which it currently is).

    Edit:
    Forgot to put an if branch correction :/
    Convert the comparison to an array:
    PHP Code:
    $aValidIPs = array('174.120.27.187''174.120.146.43'); // You could actually subnet check these, but we won't be doing that here.
    if (in_array($ip$aValidIPs) && $sts == 1// This is probably what you want.
    // Alternatively:
    if ($sts == && ($ip == '174.120.146.43' || $ip == '174.120.146.43')) 
    Last edited by Fou-Lu; 08-24-2011 at 11:22 PM.

  • Users who have thanked Fou-Lu for this post:

    markman641 (08-24-2011)

  • #4
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Fou-Lu View Post
    Sorry, at which point is $points empty? From the GET or within the database?
    When im looking at my recent points table in phpmyadmin, is says
    (username) has just cashed out for Bankroll Bucks
    which leaves me wondering why its blank. Also, I didn't quite understand what you meant with the IP stuff, do i replace
    Code:
    if ($ip == "174.120.27.187" || "174.120.146.43" && $sts="1")
    with

    Code:
    if ($sts == 1 && ($ip == '174.120.146.43' || $ip == '174.120.146.43'))
    ??
    Last edited by markman641; 08-24-2011 at 11:35 PM.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    It would be replaced.

    I've also explained why that text is empty:
    Quote Originally Posted by Fou-Lu
    Your actual message there is correct though. You haven't defined $rate anywhere.
    Also, those two update queries can be combined into one update query since the where condition doesn't change.

  • Users who have thanked Fou-Lu for this post:

    markman641 (08-24-2011)

  • #6
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    OH i just noticed it said $rate instead of points, but my users are still not getting credited for the points BECAUSE:

    1. I need to take the $points, multiply that buy 100 (because the affilate tries to award it in a decimal like cash) so that its not a decimal

    2. Multiply what number 1 outputs by .7 (to get 70 percent)

    3. floor(round down) that number in case it is a decimal, then put that into the script.

    I tried to do all that above, after i did that i broke the script so i deleted it

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Then points would become:
    PHP Code:
    $points floor(((float)$_GET['rate'] * 100) * 0.7); 
    Or cast to an int instead of floor (either will work).

  • Users who have thanked Fou-Lu for this post:

    markman641 (08-24-2011)

  • #8
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Fou-Lu View Post
    Then points would become:
    PHP Code:
    $points floor(((float)$_GET['rate'] * 100) * 0.7); 
    Will that do it in the order i want? floor LAST? THANKS by the way!!

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by markman641 View Post
    Will that do it in the order i want? floor LAST? THANKS by the way!!
    Yes. Expressions will work from the inside out.

  • Users who have thanked Fou-Lu for this post:

    markman641 (08-24-2011)

  • #10
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    As long as im here, may I speak to you on AIM or skype or something about another subject?

  • #11
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by markman641 View Post
    As long as im here, may I speak to you on AIM or skype or something about another subject?
    I don't do any internet phoning.
    You may post any other questions in the forums.

  • #12
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    Ok it seems like the script isnt working completely yet. It says
    Admin has just cashed out for 0 Bankroll Bucks
    So i don't know why its 0

  • #13
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by markman641 View Post
    Ok it seems like the script isnt working completely yet. It says

    So i don't know why its 0
    PHP Code:
    printf('GET rate: %s, points: %d'$_GET['rate'], $points); 
    Anytime after the creation of $points. If both show 0's, then the URL you have specified does not include a 'rate' in its querystring.

  • #14
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    Could it be that it needs to be
    Code:
    $_GET['%rate%']
    ?

    Look at this screenshot of all the variables:

    http://snpr.cm/o1T5om.png

  • #15
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    OHHHHHHHHHHHHHHHHHH WAIT I THINK I FIGURED IT OUT!! I have my link set as

    http://www.money4every1.net/proleads...redit=%credit%

    when it should be

    http://www.money4every1.net/proleads...redit=%credit%&rate=%rate%

    It worked!! cool! thank you!!
    Last edited by markman641; 08-25-2011 at 12:56 AM. Reason: it worked


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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