Jump to content

dflow

Members
  • Posts

    631
  • Joined

  • Last visited

Everything posted by dflow

  1. actually i can say it is posting but it isnt inserting the data into the db when the action is set in the form but the insert is depended on the submit image posted. also when i try to insert if(isset($_POST['isSubmitted$'])) with a predefined isSubmitted=1 it doesnt execute the insert query
  2. when i remove the action from the form it submits the post correctly if not it goes to the action url withoutposting <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" target="_top" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="wwww"> <?php <input type="hidden" name="item_name" id="item_name" value="<?php echo $md5c;?>"> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Submit Form"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> <?php if(isset($_POST['submit_x']) || isset($_POST['submit_x'])) { //$Subscription_id = mysql_real_escape_string($md5c); $PropertyID = mysql_real_escape_string($rowData['ID']); $User_ID = mysql_real_escape_string($rowData['User_ID']); $item_name=mysql_real_escape_string($_POST['item_name']); //$query = 'INSERT INTO SP_subscriptions(id,) values("'.$item_name.'")'; $query = 'INSERT INTO SP_subscriptions(id,PropertyID,User_ID) values("'.$item_name.'","'.$PropertyID.'","'.$User_ID.'")'; $success = mysql_query($query); echo $query; } else echo 'POST nada'; var_dump($_POST); var_dump($query); ?>
  3. OK for anyone interested here is the solution: use the item_name to post a CustomerID/orderid etc
  4. this works great now a new question can i pass variables to the paypal session? for example a customer id?
  5. cheers, will check it out
  6. i have the following script first im getting INVALID messaged returned by mail when sending and IPN test from the paypal sandbox don't really know how to debug it <?php //require("config.php"); // this is optional but useful for setting up database access constants etc // The majority of the following code is a direct copy of the example code specified on the Paypal site. // Paypal POSTs HTML FORM variables to this page // we must post all the variables back to paypal exactly unchanged and add an extra parameter cmd with value _notify-validate // initialise a variable with the requried cmd parameter $req = 'cmd=_notify-validate'; // go through each of the POSTed vars and add them to the variable foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; // In a live application send it back to www.paypal.com // but during development you will want to uswe the paypal sandbox // comment out one of the following lines $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); //$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); // or use port 443 for an SSL connection //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) { // HTTP ERROR Failed to connect // You can optionally send an email to let you know of the problem // or add other error handling. //email $mail_From = "From: [email protected]"; $mail_To = $email; $mail_Subject = "HTTP ERROR"; $mail_Body = $errstr;//error string from fsockopen mail($mail_To, $mail_Subject, $mail_Body, $mail_From); // // If you want to log to a file as well then uncomment the following lines // You can use these later on in the script as well // // $fh = fopen("logipn.txt", 'a');//open file and create if does not exist // fwrite($fh, "\r\n/////////////////////////////////////////\r\n HTTP ERROR \r\n");//Just for spacing in log file // // fwrite($fh, $errstr);//write data // fclose($fh);//close file } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // assign posted variables to local variables // the actual variables POSTed will vary depending on your application. // there are a huge number of possible variables that can be used. See the paypal documentation. // the ones shown here are what is needed for a simple purchase // a "custom" variable is available for you to pass whatever you want in it. // if you have many complex variables to pass it is possible to use session variables to pass them. $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $item_colour = $_POST['custom']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; //full amount of payment. payment_gross in US $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; //unique transaction id $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; // use the above params to look up what the price of "item_name" should be. $amount_they_should_have_paid = lookup_price($item_name); // you need to create this code to find out what the price for the item they bought really is so that you can check it against what they have paid. This is an anti hacker check. // the next part is also very important from a security point of view // you must check at the least the following... if (($payment_status == 'Completed') && //payment_status = Completed ($receiver_email == "<insert your business account email>") && // receiver_email is same as your account email ($payment_amount == $amount_they_should_have_paid ) && //check they payed what they should have ($payment_currency == "GBP") && // and its the correct currency (!txn_id_used_before($txn_id))) { //txn_id isn't same as previous to stop duplicate payments. You will need to write a function to do this check. // everything is ok // you will probably want to do some processing here such as logging the purchase in a database etc // you can also during development or debugging send yourself an email to say it worked. // email is a good choice because you can't display messages on the screen as this processing is happening totally independently of // the main web page processing. // uncomment this section during development to receive an email to indicate whats happened // $mail_To = "[email protected]"; // $mail_Subject = "completed status received from paypal"; // $mail_Body = "completed: $item_number $txn_id"; // mail($mail_To, $mail_Subject, $mail_Body); } else { // // paypal replied with something other than completed or one of the security checks failed. // you might want to do some extra processing here // //in this application we only accept a status of "Completed" and treat all others as failure. You may want to handle the other possibilities differently //payment_status can be one of the following //Canceled_Reversal: A reversal has been canceled. For example, you won a dispute with the customer, and the funds for // Completed the transaction that was reversed have been returned to you. //Completed: The payment has been completed, and the funds have been added successfully to your account balance. //Denied: You denied the payment. This happens only if the payment was previously pending because of possible // reasons described for the PendingReason element. //Expired: This authorization has expired and cannot be captured. //Failed: The payment has failed. This happens only if the payment was made from your customer’s bank account. //Pending: The payment is pending. See pending_reason for more information. //Refunded: You refunded the payment. //Reversed: A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from // your account balance and returned to the buyer. The reason for the // reversal is specified in the ReasonCode element. //Processed: A payment has been accepted. //Voided: This authorization has been voided. // // // we will send an email to say that something went wrong $mail_To = "[email protected]"; $mail_Subject = "PayPal IPN status not completed or security check fail"; // //you can put whatever debug info you want in the email // $mail_Body = "Something wrong. \n\nThe transaction ID number is: $txn_id \n\n Payment status = $payment_status \n\n Payment amount = $payment_amount"; mail($mail_To, $mail_Subject, $mail_Body); } } else if (strcmp ($res, "INVALID") == 0) { // // Paypal didnt like what we sent. If you start getting these after system was working ok in the past, check if Paypal has altered its IPN format // $mail_To = "[email protected]"; $mail_Subject = "PayPal - Invalid IPN "; $mail_Body = "We have had an INVALID response. \n\nThe transaction ID number is: $txn_id \n\n username = $username"; mail($mail_To, $mail_Subject, $mail_Body); } } //end of while fclose ($fp); } ?>
  7. roger that
  8. the following isnt sending mail() $to=$_POST['CustomerEmail']; $from = "[email protected]"; $Cc = "[email protected]"; $headers = "From:" . $from; $headers = "Cc:" . $Cc; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; i believe it's the dot before the equal sign
  9. this looks gr8 always wanted to get into games myself, thanks
  10. anyone dealt with Paypal Checkout inside a Facebook iframe?
  11. thanks i'll try it out
  12. i have a list of check boxes im ordering it according to Amenity name ASC im floating 2 divs (columns)side by side how can i get the list to echo it according to ABC : like this::? A D B E C F <?php echo '<div style="height:800px;" />'; foreach($amens as $amen) { echo '<div style="float:left;padding-left: 2px;width:200px;"><input onclick="changedata(this)" type="checkbox" id="mm'.$amen['Amen_ID'].'" value="'.$amen['Amenity'].'" '.checkAmenity($id, $amen['Amenity']).' /><label style="padding-left:3px;" for="mm'.$amen['Amen_ID'].'">'.$amen['Amenity'].'</label></div>'; } echo '</div>'; ?>
  13. what do you mean? how would i call an apartment images list?
  14. apartments.ID=images.ID
  15. i ahve a lis i need to UPDATE mainimage in the apartments table with the image list foreach apartment ID, hence the first row in the list foreach apartment ID
  16. trying to combine and execute this UPDATE `apartments` SET mainImage = (select DISTINCT(ImageURL) from images where ID LIMIT 1,1) WHERE InternalSupplierID=7; //while:Id needs to be distinct like the list bellow, the above inserts the first row continuously (SELECT DISTINCT(ID) FROM `apartments` WHERE `InternalSupplierID` =7) //need LEFT JOIN?
  17. dflow

    quick UPDATE

    cheers!
  18. dflow

    quick UPDATE

    this updated, but only ID.jpg without -0 output: 34567.jpg instead of 34567-12-0.jpg thanks ill read about CONCAT
  19. dflow

    quick UPDATE

    still quote error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(50)),'.jpg') WHERE InternalSupplierID=7' at line 1
  20. dflow

    quick UPDATE

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'jpg WHERE InternalSupplierID=7' at line 1
  21. dflow

    quick UPDATE

    how can i perform this directly in phpmyadmin : UPDATE `apartments` SET mainImage = ID-SupplierID-0.jpg WHERE InternalSupplierID=7'; ID SupplierID are table fields in apartments it's actually a foreach loop
  22. so what do you suggest and any recommendations for frameworks?
  23. so go the OOP route?
  24. in mess i meant that my html is with my php i understand that MVC will sparate the data, layout and logic but it is OB oriented with files i dont really like that.
  25. my php coding experience has apparently accumulated to something substantial but my coding practices are a big mess, currently i am writing procedural scripts not using MVC etc need suggestions on how to , what to use to make my life more organised and what would be the best for maintainable code?
×
×
  • 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.