Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Necuima

  1. OK, if you look in "browse" for the PHP6 book it is the latest post in that topic. Sorry, it is under my name.
  2. It looks like you have created the database but have you created the tables? Cheers, Necuima
  3. So glad that you got it to work for you. As mentioned, it has always worked flawlessly for me, both in my development environment and in production. Best wishes, Necuima
  4. Re reading a PDF - you could have a look at: https://www.pdfparser.org/ but I have not used it. Cheers
  5. Hi Jai, Mr Ullman has a great book on e-commerce - "Effortless E-Commerce" - 2nd edition with PHP and MySQL. Cheers
  6. Hi, I am sorry but I don't think that I can help you with this but I did notice "Username and Password not accepted" - did you check out the link at the end of that message? I use my Internet login details with my service provider and have never had a problem. These details may or may not be the same as your email address. Hope it helps.
  7. I do not use a proxy server. And my statement that you need to be logged in to your email service may be a bit mis-leading. You need to be logged in to the Internet with your service provider.
  8. Ok, the following is how I send emails from PHP. Uses PHPMailer. In XAMPP you need to tell it where your normal email connection is. $host = substr($_SERVER['HTTP_HOST'], 0, 5); if (in_array($host, array('127.0', '192.1', 'local'))) { $local = TRUE; // echo "Local is true, HOST is $host"; } else { $local = FALSE; // echo "Local is false, HOST is $host"; } if ($local) { // tests for using XAMPP locally ini_set('sendmail_from', 'your email address'); // needed for Win 10 localhost (Development) ini_set('SMTP', 'your email service SMTP server'); // needed for Win 10 localhost (Developmemt) } require './includes/PHPMailer/PHPMailerAutoload.php'; // available as a free download $mail = new PHPMailer(true); $mail->setFrom(EMAIL, 'Whoever'); $mail->addAddress(EMAIL, 'Whoeverr'); if ($local) $mail->Subject = 'The email subject'; else $mail->Subject = 'The email subject'; $mail->Body = 'The email body'; $mail->addAttachment($report_file); // optional if(!$mail->send()) { echo '<p>Message was not sent.</p>'; echo '<p>Mailer error: ' . $mail->ErrorInfo . '</p>'; } The EMAIL constant has the email address that I want to show the email was sent from/to - in this case the receiver and the sender are the same email address - just change them to whatever you want to use. Hope it helps. P.S., assumes that you are logged in to your email service. PPSS, I use PHPMailer as it lets you attach a file to an email if you want/need to.
  9. There is also a similar example in detail using jQuery in the book "JQuery in Action, 2nd Edition" chapter 8.
  10. OK, I'll use the timestamp approach. Thanks for the advice. Cheers, Necuima
  11. Hi Larry, I finally got to the point in my complete software re-load/re-build where I could test your suggestion. I re-downloaded the script from your website and made the suggested change but unfortunately I am still getting the error "on line 29: session_write_close(): Session callback expects true/false return". Here is my modified code: // Define the close_session() function: // This function takes no arguments. // This function closes the database connection. function close_session() { global $sdbc; mysqli_close($sdbc); return true; // return mysqli_close($sdbc); } // End of close_session() function. My environment is XAMPP 7.3.5 with PHP 7.3.5 both 64 bit under Windows 10 (64 bit). I know that you are a very busy man so please treat this as low priority - I will use a work-around. Best regards, Necuima.
  12. Hi Larry, On pages 284-5 you mention the browser unload event. I'd appreciate your advice re what I imagine is a common issue in that if someone just closes the browser without logging out I want to be able to update a database table to set a logged-out condition. Can this be done reliably either with native JavaScript or jQuery initiating an AJAX call to a PHP module to effect the database update? My program is PHP with lots of jQuery. Looking forward to your advice re this or similar functionality and thank you in anticipation. Cheers, Necuima
  13. Hi Larry, Thanks for this. I have been having computer troubles and am having to re-build ALL my software from a clean Win 10 installation. Fortunately I have great backups :-) I'll test again when I have re-installed XAMPP. Thank you for following this up. Cheers from Oz, Necuima
  14. P.S., the script is your script 'sessions.php' just renamed and on your original it is line 53. Up top I just added As per your 'advanced' book.
  15. Hi Larry, Finally got to a point where I could try your suggestion. Sadly, if I applied your suggestion correctly, it did not solve the issue. Please see the attached. The database entry looks OK. Cheers, Necuima
  16. Hi Priyam, What script in Larry's book are you trying to use (and page number in the book)? Also see: https://www.w3schools.com/php/func_mysqli_num_rows.asp Necuima
  17. Hi Larry, This time it is me that is sorry re the delay in responding. I have just started changing over from Win 7 to Win 10 which is inhibiting my ability to test your proposed solution. I have a LOT of stuff on the Win 7 PC so am taking it very carefully - bit by bit - as I make the change to the (separate) Win 10 PC. Also am making the change from Windows Live Mail to Outlook and that's not as straight-forward as one might imagine especially as I want to migrate all my email storage folders over to Outlook. I will test your suggestion as soon as I can but it might be a couple of weeks before I can - and please accept my apologies for my tardiness. Cheers from Oz.
  18. Hi Larry, I can see the test charges now - they don't show in the dashboard until you capture them. Thanks as always for your insights. Cheers, Necuima
  19. Mmmm, I have the charge captured now but to be truthful I don't properly understand this. I retrieved the id from the response body: $charge__id = $charge->id; $charge = \Stripe\Charge::retrieve($charge__id); $charge->capture(); and the id is clearly not the token. So I hope that I am doing it correctly! A further query, I cannot see 'response_reason_text' in the log so maybe it is only there if the charge gets rejected? Again, any advice will be most appreciated. Thanks, Necuima
  20. Thanks to the advice received, I am making progress. I can send a charge for payment and receive confirmation that it is marked as 'paid'. But I have a puzzlement re page 518 re 'capturing charges'. Firstly, it seems that the charge_id is the token - is my understanding on this point correct? I used that anyway in the 'retrieve' statement and it did not object. (I am adapting Larry's code here for my own purposes, in fact a single charge). The '$charge->paid returns true which I test in my code and I can also see it in the Stripe test log. It does this whether I invoke the 'retrieve' and 'capture' statements or not. But the dashboard does not show any $s even though I have now sent dozens of charges all of which have returned true for paid. Any advice will be most appreciated and thank you in anticipation. Necuima
  • Create New...