Jump to content

requinix

Administrators
  • Posts

    15,232
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. ...If the upload isn't successful then don't do anything with the file. Only when error=UPLOAD_ERR_OK (0), the first thing you should check, do you continue with the process and bother to check file extensions and types and whatnot. The ones that don't upload: how about a more useful error message than "something is wrong"? There are error codes you can look up to find out what happened.
  2. You're welcome No. The part I'm talking about isn't there. Not in any of the files you posted. None of them. Only that second script you found (and discarded) way back when had it. I'm sorry that you don't know anything about IPN. I'm sorry that you went out and bought something incomplete. I'm sorry that you think you have all the pieces when you don't. But I'm not sorry that you're leaving.
  3. That "final script" is still missing the part that verifies the IPN message. That was the problem. Big problem. You need to write code so that it verifies the message or else use a different script.
  4. So don't duplicate the label: print it once and then print out all the additional information you found.
  5. Heck, you don't even need callbacks for it at all. And don't worry about the ?>s: PHP's smart enough to know not to stop processing in the middle of a string. And the only difference between the search and replacement string is using the long open tags, so don't bother searching for the long ones. To avoid matching [ic]<?php[/i], use a negative assertion: "there must not be a 'php' at this point". $template = preg_replace("/\?>(\r*\n*.*)$1
  6. $_SERVER["HTTP_REFERER"], but know that it is not reliable: might not be there, might not have the correct value, might not even be a URL at all...
  7. You haven't called session_start(). Need to do that before you can use $_SESSION. It also has to happen before you've outputted anything so you can't put it in that code you've posted.
  8. You may need ten posts to do it. Try now.
  9. That second script is much better. Still could use a bit of work but it actually looks like an IPN script. First it seems like you need a bit of a primer on how IPN works. When enabled, users go through your site, then to PayPal to make a purchase, then return to somewhere on your site depending on success or failure. That place is only for a thank you message (success) or something else, like returning to the "checkout" page (failure) - not for taking any real actions. PayPal, in the background, processes the purchase from the user. It may be successful or not. They then send an IPN message directly to your server - no user involvement whatsoever - indicating what has happened with the transaction: success, failure, amount, some user information, that kind of stuff. As far as your PHP code is concerned it looks like someone POSTed a form to a page. It is at that point that your site decides what to do for a successful transaction. Such as grant those "point" things. Normally the IPN message will arrive shortly after checkout (like, seconds) but that's certainly not guaranteed. An important part of this process is what your PHP script does with the IPN message: before taking any actions it has to verify the message with PayPal by sending the message back almost verbatim. PayPal then tells you whether it's good or not. That's what the first script was missing and why I said it was incomplete. The second script has that. However there is one important fact you might have missed in all that: PayPal is the one sending the IPN message, not the user. The user has no idea this is happening and are not involved in it at all. So the answer to is "This is not possible due to how IPN works". All you can do is send the user back to a thank you page once they've finished checkout. You could find ways to redirect the user (by storing something in the database when the IPN message comes through, then making your website's normal code check for that on every page load and act appropriately) but I wouldn't recommend a redirect. If anything, maybe a sort of "Your transaction has been completed and you now have X points" popup message. Now, to your code. if ($_POST["payment_status"] == "COMPLETED")I'm not sure the payment_status is an uppercase "COMPLETED". session_start(); $_SESSION['amt']=$_POST['amount'];Don't use the session in this script. All you're doing is setting up a session for PayPal and they don't care about it. $playerKey=$_SESSION['userid'];Not available because this is PayPal accessing the page, not the user. You have to grab the user information from the IPN message, and what it is depends on what you put in your checkout form. or die("Couldn't find in database.");die()ing with a message won't do anything. Nobody will see it.
  10. Is that the IPN script you bought? It's... incomplete. Assuming you added in the stuff with the payment_status=COMPLETE, the only thing in the script was the part that dumped the message into a text file?
  11. The IPN script. That's the one that PayPal posts data to and that's the place where you know the transaction went through. What's the IPN script look like and where did you try putting your code?
  12. It cannot be done period. More precisely, cannot be done with anything besides Flash or Java or something else big and clumsy like that.
  13. Always nine digits? I'd take the easy way out: substr($string, 0, 3) . " " . substr($string, 3, 2) . " " . substr($string, 5, 2) . "-" . substr($string, 7, 2)
  14. Well, doing the query twice could certainly cause that. mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo $query; $result_update = mysql_query($query);
  15. What have you tried so far?
  16. Would help to know what this "trouble" you're having is.
  17. So what's your code now after the changes you made?
  18. That. That. htmlentities() the data first, then nl2br() to add HTML "line breaks" to the actual text line breaks. Looks like <?php echo nl2br(htmlentities($value, ENT_COMPAT, '')); ?>and outputs roughly New Event Details<br> <br> Blah blah blah<br> <br> some more text here
  19. Considering how OP abandoned this thread six months ago I don't think you'll get an answer.
  20. Have you already (re)named the files? $today = date('l');That's what it uses to determine the name of the file. Check the documentation to see how to make it return a day number instead of a weekday name.
  21. So make the [a-zA-Z] and the slash optional. $route['([a-zA-Z]+/)?(:any)'] = '$2';
  22. I was just demonstrating how the code you posted works correctly for me: $new_amount = 0.000015.
  23. $ php -a Interactive shell php > $total_amount = 0.001; php > $percentage = 1.5; php > $new_amount = ($percentage / 100) * $total_amount; php > echo $new_amount; 1.5E-5 php >
  24. Use tags when posting code. . 'You have the link pointing to a target "my_pdf" that, as far as I can see, doesn't exist anywhere on the page. Remove the target.
  25. Not sure if I understand, but maybe $dataplayers = $datatime = array(); while($row = mysql_fetch_array($mysql_result)) { $dataplayers[] = $row['players']; $datatime[] = $row['time']; }Also, stop using the mysql extension and its mysql_* functions and move to PDO or mysqli. Why? Because it's old, insecure, slow, and no longer supported with PHP.
×
×
  • 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.