Jump to content

austin752

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by austin752

  1. I have been trying for days to get my alertpay ipn to update my database. I thought I had it but obviously I don't. Please help. here is the last bit of code I put together. $rs[4] is my merchant email address $rs[23] is my alertpay security code include "config.php"; $sql=mysql_query("Select * from adminsettings"); $result = mysql_query($sql); $rs = mysql_fetch_array($result); //The value is the Security Code generated from the IPN section of your AlertPay account. Please change it to yours. define("IPN_SECURITY_CODE", "". $rs[23].""); define("MY_MERCHANT_EMAIL", "". $rs[4] .""); //Setting information about the transaction from the IPN post variables $ap_SecurityCode = $_POST['ap_securitycode']; $ap_CustFirstName =$_POST['ap_custfirstname']; $ap_CustLastName = $_POST['ap_custlastname']; $ap_CustAddress = $_POST['ap_custaddress']; $ap_CustCity = $_POST['ap_custcity']; $ap_CustCountry = $_POST['ap_custcountry']; $ap_CustState = $_POST['ap_custstate']; $ap_CustZip = $_POST['ap_custzip']; $ap_CustEmailAddress = $_POST['ap_custemailaddress']; $ap_PurchaseType = $_POST['ap_purchasetype']; $ap_Merchant = $_POST['ap_merchant']; $ap_ItemName = $_POST['ap_itemname']; $ap_Description = $_POST['ap_description']; $ap_Quantity = $_POST['ap_quantity']; $ap_Amount = $_POST['ap_amount']; $ap_AdditionalCharges=$_POST['ap_additionalcharges']; $ap_ShippingCharges=$_POST['ap_shippingcharges']; $ap_TaxAmount=$_POST['ap_taxamount']; $ap_DiscountAmount=$_POST['ap_discountamount']; $ap_TotalAmount = $_POST['ap_totalamount']; $ap_Currency = $_POST['ap_currency']; $ap_ReferenceNumber = $_POST['ap_referencenumber']; $ap_Status = $_POST['ap_status']; $ap_ItemCode = $_POST['ap_itemcode']; $ap_Test = $_POST['ap_test']; $ap_SubscriptionReferenceNumber = $_POST['ap_subscriptionreferencenumber']; $ap_TimeUnit = $_POST['ap_timeunit']; $ap_PeriodLength=$_POST['ap_periodlength']; $ap_PeriodCount=$_POST['ap_periodcount']; $ap_NextRunDate=$_POST['ap_nextrundate']; $ap_TrialTimeUnit=$_POST['ap_trialtimeunit']; $ap_TrialPeriodLength=$_POST['ap_trialperiodlength']; $ap_TrialAmount=$_POST['ap_trialamount']; $ap_Apc_1 = $_POST['apc_1']; $ap_Apc_2 = $_POST['apc_2']; $ap_Apc_3 = $_POST['apc_3']; $ap_Apc_4 = $_POST['apc_4']; $ap_Apc_5 = $_POST['apc_5']; $ap_Apc_6 = $_POST['apc_6']; $transactionDate = date('d-m-Y H:i:s'); if ($receivedMerchantEmailAddress != $rs[4]) { // The data was not meant for the business profile under this email address. // Take appropriate action. error_log('wrong merchant email address', 0); } else { // Check if the security code matches if ($mySecurityCode != $rs[23]) { // The data is NOT sent by AlertPay. // Take appropriate action. error_log('wrong security code', 0); } else { // Check if it is an initial payment for a subscription if ($purchaseType == "subscription" && $transactionStatus == "Success") { //no trial period } elseif ($purchaseType == "subscription" && $transactionStatus == "Subscription-Payment-Success" && $subscriptionPaymentNumber > 1) { mysql_query("INSERT INTO `payment_history`(`member_id`, `account`, `firstname`, `lastname`, `address`, `city`, `state`, `zip`, `country`, `amount`, `paid`, `transaction_number`, `date`) VALUES ($ap_Apc_1, $ap_CustEmailAddress, $ap_CustFirstName, $ap_CustLastName, $ap_CustAddress, $ap_CustCity, $ap_CustState, $ap_CustZip, $ap_CustCountry, $ap_Amount, 1, $ap_ReferenceNumber, $transactionDate)"); } else { switch ($transactionStatus){ case "Subscription-Expired": // Take appropriate when the subscription has reached its terms. break; case "Subscription-Payment-Failed": // Take appropriate actions when a payment attempt has failed. break; case "Subscription-Payment-Rescheduled": // Take appropriate actions when a payment is rescheduled. break; case "Subscription-Canceled": // Take appropriate actions regarding a cancellation. break; default: // Take a default action in the case that none of the above were handled. break; } } } } I attached the full file if you want to look at that 18331_.php
  2. That didnt work. With all of my extra code stripped out, the basic function I need is to pass the ID of the member into a variable that populates a field in an email to validate the email address. $sqlid = "select * from temp where Email='".$a[8]."'"; $idresult = mysql_query($sqlid) or die(mysql_error()); $res = mysql_fetch_assoc($idresult); if (mysql_num_rows($idresult) > 0) { $tempid = $res['ID']; } $message = "Dear member,<BR><BR>"; $message = $message . "Welcome to " . $sitename . ".<BR>"; $message = $message . "Thank you for registering.<br /> Please click the button below to activate your account. You will not be able to access the download area, the member benefits, or be eligible for earnings until you activate your account.<br /><br />"; $message = $message . "<a href=" . $siteurl . "/activate.php?e=".$a['8']."&b=verify&id=".$tempid."> Click here to finish activating your account -></a><BR>"; When I added your snippet it still didn't insert the ID into the right place. Just before this code is: include "config.php"; $sql_i="insert into temp(Name,Address,City,State,Zip,Country,Phone,Email,Password,PaymentDetails,ref_by,IP,Date) values ( '$a[1]', '$a[2]', '$a[3]', '$a[4]', '$a[5]', '$a[6]', '$a[7]', '$a[8]', '$a[9]', '$a[10]', '$a[11]', '$a[12]', now() )"; I am guessing this is when the id is created. then I want to pull the ID out right after the fields are populated. Make sense?
  3. I have been coding in circles and I can't take it anymore! This is my code: $sqlid = "select * from temp where Email='".$a[8]."'"; $idresult = mysql_query($sqlid); $res = mysql_fetch_assoc($idresult); if ($idresult > 0) { $tempid = $res['ID']; die('sql id:' . $tempid . 'or' . $res['ID']. 'or ' . $sqlid ); }elseif (!$idresult) { die('there is no sql id'); } I am trying to populate the variable $tempid with the ID from the temp table. I know i am not the best coder but I thought I was close. I keep getting different errors. Some errors simply print out the sql select statement to the screen Other errors give me a resource #10. Please help. I can't think straight anymore. Im sure it's something simple.
×
×
  • 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.