SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Cape Town
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Sending variables to multiple pages...

    Hi there guys.

    Please will someone help - im so stuck and ive spent the last week trying to figure this out.

    Right, someone comes to my create_account.php page. User fills in the information and clicks "submit" - the info is verified, and added to the database and the user is directed to the create_success.php page.

    Right, that works 100%. The problem now is : the information that the user filled in also needs to be sent to my payment gateway for them to add to their database. Thing is I dont want my users to be directed there. The information must just be sent without the user knowing??!?

    This is what I need to send :

    Overview

    When the user have previously registered on the merchantís website the registration information can be passed to Setcom using the additional fields outlined below. These fields need to be used in addition to the Credit Card Form implementation.


    Registration Variables

    Field Name Required (Y/N) Description
    Username Yes This is the email address of the new buyer. This must be unique.
    Password Yes This is the buyerís password.
    ConfirmPassword Yes This field is present at a new user registration. This must match the Password field exactly to be processed further.


    Profile Variables

    Field Name Required (Y/N) Description
    Name Yes The name and surname of the buyer.
    Address1 Yes Address line one of the buyer.
    Address2 Yes Address line 2 of the buyer.
    City Yes City / major centre of the buyer.
    State Yes State / province of the buyer.
    Zip Yes Zip / postal code of the buyer.
    Country Yes 2-digit country code of the buyer as used by Setcom. See country code list.
    Tel Yes Telephone number of the buyer.
    Addonfields Yes Additional information is passed through in this field. Two Additional fields of information is required:
    1. Identity number
    2. Additional contact telephone

    These fields must be passed through as values to the form and separated using semi-colons (. Example:

    Identity:5001011234567;Telephone Number 2:+27-11-555-5555

    See sample HTML Code (Attached)
    Description Yes This field must contain information of the products or services ordered. It should contain the product description, quantity, and item total for all items. Shipping and the grand total for the order should also be included.

    This information is used to resolve disputes.
    Please guys some help out really be appreciated.

    Thanks again - if you need the information in the create_account.php page please let me know and i'll post it...

    Thanks,

    Nick

  2. #2
    o_O O_o BlueFire2k5's Avatar
    Join Date
    Mar 2003
    Location
    Sioux Falls, SD
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try working with sockets. fsockopen() will open your socket, and then you can send either GET or POST information to the server. This would all be without your user knowing anything.

  3. #3
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use CURL. php.net/curl

    This is a nochex example using curl - http://greenroom.nochex.com/viewtopic.php?t=1182

    I like it because you can give it a string like http://www.url.com/page?value=foo&value2=foo2 and it will do it as a post. SSL Support too

  4. #4
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Cape Town
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Gee....

    Whoo hoo... thanks guys...

    Gee, but now nick is really confuzzled. I spent the last week trying to furure this out with no luck... - now people are throwing new things at me... fsockopen() and curl <-heard a teeny bit about curl but nothing of fsockopen()....betta get reading then i suppose...

    Tell me though...Would this now work?

    Original snippet :
    if ($error == false) {
    $sql_data_array = array('customers_firstname' => $firstname,
    'customers_lastname' => $lastname,
    'customers_email_address' => $email_address,
    'customers_telephone' => $telephone,
    'customers_fax' => $fax,
    'customers_newsletter' => $newsletter,
    'customers_password' => tep_encrypt_password($password),
    'customers_password2' => $password);

    if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
    if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = $dob;
    // Guest Account Start
    if ($guest_account) $sql_data_array['guest_flag'] = '1';
    tep_db_query("update " . TABLE_CUSTOMERS . " set customers_email_address = '@_" . $email_address . "' where customers_email_address = '" . $email_address . "' and guest_flag = '1'");
    tep_db_query("update " . TABLE_CUSTOMERS . " set customers_lastname = '@_" . $lastname . "' where customers_email_address = '@_" . $email_address . "'");
    // Guest Account End
    tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

    $customer_id = tep_db_insert_id();

    $sql_data_array = array('customers_id' => $customer_id,
    'entry_firstname' => $firstname,
    'entry_lastname' => $lastname,
    'entry_street_address' => $street_address,
    'entry_postcode' => $postcode,
    'entry_city' => $city,
    'entry_country_id' => $country);

    if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
    if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
    if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
    if (ACCOUNT_STATE == 'true') {
    if ($zone_id > 0) {
    $sql_data_array['entry_zone_id'] = $zone_id;
    $sql_data_array['entry_state'] = '';
    } else {
    $sql_data_array['entry_zone_id'] = '0';
    $sql_data_array['entry_state'] = $state;
    }
    }

    tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

    $address_id = tep_db_insert_id();

    tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
    // Guest Account Start
    if (!$guest_account) {
    tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . tep_db_input($customer_id) . "', '0', now())");
    } else {
    tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . tep_db_input($customer_id) . "', '-1', now())");
    }
    and just add the following just before it writes to the database?

    <FORM METHOD="Post" ACTION="https://secure.setcom.co.za/creditcard2.cfm">
    <INPUT TYPE="Hidden" NAME="CO_ID" VALUE="ppsample@setcom.co.za">
    <INPUT TYPE="Hidden" NAME="Outlet" VALUE="ppsample@setcom.co.za">
    <INPUT TYPE="Hidden" NAME="Reference" VALUE="YourUniqueReference">
    <INPUT TYPE="Hidden" NAME="CC_Amount" VALUE="1.00">

    <INPUT TYPE="Hidden" NAME="Username" VALUE="test@setcom.co.za">
    <INPUT TYPE="Hidden" NAME="Password" VALUE="123456">

    <INPUT TYPE="Submit" VALUE=" Pay now ">
    </FORM>

  5. #5
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please dont expect people to read let alone that code you pasted lol

    the information that the user filled in also needs to be sent to my payment gateway for them to add to their database
    CURL and fsockopen can do the same things, send headers to a website, instead of your browser doing it. I dont know how your payment gateway works, but take a good look at the nochex example i gave. When a user enters their details, it calls that script, and it has certain parameters such as amount and order_id, and if the payment was authorized or not, then you can update your database.

    I hope that helps.

  6. #6
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Cape Town
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ahhhhhhh......

    Ahhhhhh.... i see, okie dokie.... busy fiddling with it but it seems almost impossible.

    Can i ask one quick last(hopefully) question? What does this do? :

    $transaction_id = $_POST['transaction_id'];
    $transaction_date = $_POST['transaction_date'];

    Doesnt make sense as im just posting the variables right?

    Now, I have the variables and just need to post them to Setcom(Gateway) - they are not going to give me any type of response(as far as i know) - im just sending them the customers details(no ammounts, products etc etc...just address and tel number etc)

    Right, lets hope i can get this working now!!

    Thanks for the help bro,

    Nick


Bookmarks

Posting Permissions

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