Results 1 to 3 of 3

Thread: Update database to mark ad as paid and expiry date

  1. #1
    Thread Starter
    Junior Member mijmu's Avatar
    Join Date
    Jul 2011
    Posts
    27
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Update database to mark ad as paid and expiry date

    Hi

    I am looking to implement paygol on my website. I have the pay part working but now I need to update my database. This is where I am lost.

    Paygol provide the attached code to be placed in a file. This is then called when the payment is successful.

    Could someone tell me how to update the database or I can pay for someone to do it. Paygol say I can use these parameters to do the update. Custom might be used to pass maybe the post_id which can be used to update the ad as paid and the expiry date.

    Thanks
    Michael

    <?php

    // check that the request comes from PayGol server
    if(!in_array($_SERVER['REMOTE_ADDR'],
    array('109.70.3.48', '109.70.3.146', '109.70.3.58'))) {
    header("HTTP/1.0 403 Forbidden");
    die("Error: Unknown IP");
    }

    // get the variables from PayGol system
    $message_id = $_GET['message_id'];
    $shortcode = $_GET['shortcode'];
    $keyword = $_GET['keyword'];
    $message = $_GET['message'];
    $sender = $_GET['sender'];
    $operator = $_GET['operator'];
    $country = $_GET['country'];
    $custom = $_GET['custom'];
    $points = $_GET['points'];
    $price = $_GET['price'];
    $currency = $_GET['currency'];

    // Here you can do whatever you want with the variables, for instance inserting or updating data into your Database

    ?>



  2. #2
    Thread Starter
    Junior Member mijmu's Avatar
    Join Date
    Jul 2011
    Posts
    27
    Thanks
    0
    Thanked 2 Times in 2 Posts
    This is what I am doing. maybe someone can help me with this. I am Really stuck.

    In gateway.php I have added the following code which sets up the button to call paygol

    <!-- PayGol Form -->
    <form name="pg_frm">
    <input type="hidden" name="pg_serviceid" value="9999">
    <input type="hidden" name="pg_currency" value="EUR">
    <input type="hidden" name="pg_name" value="Pay by SMS">
    <input type="hidden" name="pg_custom" value= I WANT TO PASS THE UNIQUE POST ID SO AS I CAN USE IT LATER to do the update
    <input type="hidden" name="pg_price" value="2.5">
    <input type="hidden" name="pg_return_url" value="mydomain">
    <input type="hidden" name="pg_cancel_url" value="">
    <input type="image" name="pg_button" class="paygol" src="http://www.paygol.com/micropayment/img/buttons/175/pay_en_4.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!" onClick="pg_reDirect(this.form)">
    </form>

    Can someone tell me how to get and pass in the unique ID.

    Then paygol returns to a specified page (in this case paygol.php)

    This is the code I am using to update the database with the status publish.

    <?php

    // check that the request comes from PayGol server
    if(!in_array($_SERVER['REMOTE_ADDR'],
    array('109.70.3.48', '109.70.3.146', '109.70.3.58'))) {
    header("HTTP/1.0 403 Forbidden");
    die("Error: Unknown IP");
    }

    // get the variables from PayGol system
    $message_id = $_GET['message_id'];
    $shortcode = $_GET['shortcode'];
    $keyword = $_GET['keyword'];
    $message = $_GET['message'];
    $sender = $_GET['sender'];
    $operator = $_GET['operator'];
    $country = $_GET['country'];
    $custom = $_GET['custom'];
    $points = $_GET['points'];
    $price = $_GET['price'];
    $currency = $_GET['currency'];

    // Here you can do whatever you want with the variables, for instance inserting or updating data into your Database

    // if the ad is found
    $the_ad = array();
    $the_ad['ID'] = $custom;
    $the_ad['post_status'] = 'publish';
    $ad_id = wp_update_post($the_ad);
    ?>

    is this code correct.

    any help would be greatly appreciated

  3. #3
    creatrixmarketing's Avatar
    Join Date
    Oct 2012
    Posts
    32
    Thanks
    1
    Thanked 2 Times in 2 Posts
    did you ever have any luck with this?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [MOD NEEDED] Update database to mark ad as paid and expiry date
    By mijmu in forum ClassiPress General Discussion
    Replies: 1
    Last Post: October 8th, 2011, 09:57 AM
  2. Disable Expiry Date
    By schedule in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: January 21st, 2011, 10:48 AM
  3. Job Expiry date jobroller
    By geneci in forum Report JobRoller Bugs
    Replies: 8
    Last Post: November 9th, 2010, 02:36 AM
  4. Setting Ad Expiry by date.
    By strategicdm in forum Help Using ClassiPress
    Replies: 3
    Last Post: July 9th, 2010, 02:01 PM