Necuima
-
Posts
359 -
Joined
-
Last visited
-
Days Won
7
Posts posted by Necuima
-
-
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.
-
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
-
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
-
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.
-
Hi Larry,
Have you had a chance to have a look at this yet?
Thanks, Necuima
-
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
-
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
-
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
-
Yes, I now have SSL enabled on my localhost XAMPP environment - thank you for the advice.
-
It's OK - I tried \Stripe\Charge:: etc and that did not give the error.
But now I have another error which seems to be associated with an SSL certificate. As mentioned I am trying to test this on localhost which, in my case, does not have an SSL certificate.
I understood from a previous query on Stripe that I could test this from localhost without my XAMPP/Apache having an SSL certificate. Have I mis-understood this?
The beginning of the error is:
"An error occurred in script 'C:\xampp\htdocs\DMChat\modules\process_payment.php' on line 213: Stripe\Error\ApiConnection Object ( [message:protected] => Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com. (Network error [errno 77]: error setting certificate verify ..............."
This was from the catch block:
catch (Exception $e)
{ // Try block failed somewhere else.
trigger_error(print_r($e, 1));
}Again, your advice will be most appreciated,
Necuima
P.S., you can probably figure out that I am using your model/view/controller approach from the advanced book :-)
-
Hi Larry,
I am trying to use Stripe from my localhost and have established a test account with Stripe Australia.
I am getting error "Class 'Stripe\Stripe_Charge' not found in .....on line 182 - I am on page 508 in the book.
I have Stack-Overflowed and tried their solutions but none work.
I am not able to use composer as I'm using PHP 5.5.3 on Windows 7 so I did the manual download and as far as I can tell all that is OK.
Again, any advice will be most appreciated.
Cheers, Necuima
-
It's OK, I've found the issue. As my design does not follow yours exactly I need to add the additional data to the $_POST/form via hidden elements.
Sorry to have bothered you.
Necuima
-
Hi Larry,
I am trying to use STRIPE for the first time. I have set up a test account and that seems to be OK.
I am adapting your form in billing.html but in a PHP script. The validation of my data via the ajax call to Stripe is OK as I am able to submit the form but when I check what data are received by my adaptation of your billing.php I can see the posted token but no form data. My form is attached.
Can you see what I am doing wrong please?
Thanks, Necuima
-
I checked with the PHP manual and from PHP 7.2 the return from session_write_close() is a Boolean rather than a void.
Might this require an update to the session code in the book?
I tried just adding $rc = session_write_close() but I'm still getting the error.
Thanks, Necuima
-
Hi Larry,
I have been using your database session handler for quite some time now in my Windows 7 environment but have run into a problem when I try to use it in a new PC set up with Windows 10 and Apache/PHP 7.3.7 (64 bit).
I keep getting an error: "An error occurred in script 'C:\xampp\htdocs\....php' on line 53: session_write_close(): Session callback expects true/false return value" and I am getting this error everywhere that I have used 'session_write_close()' as per page 95 of the book (that's in dozens of places).
Is it perhaps not needed in Win 10 with a fairly current Apache/PHP install? Or do I need to code it differently?
Any advice will be most appreciated and thanks in anticipation.
-
The backup and restore functionality is in Larry's book "PHP 5 Advanced", Chapter 10.
-
I had the same problem and I found that I had the BASE_URL set incorrectly in module config.inc.php
Once I fixed that the activation script ran OK.
-
In case you need to have both C++/Magick++ and Imagick on your PC (localhost), after much trial and error I found, with thanks to those who posted the guidances and data following, how to install it correctly. My environment is Windows 10 with the latest 64bit XAMPP from: https://www.apachefriends.org/download.html
I installed XAMPP/PHP version 7.3.7. My development environment in this case is Visual Studio 2019 and Dreamweaver CS6.
The primary guidance is from: https://herbmiller.me/installing-imagick-php-7/ with many thanks to this gentleman. But if you follow this exactly you will not have C++/Magick++ available.
Regarding compatible Imagick dlls and ImageMagick versions, see also: https://mlocati.github.io/articles/php-windows-imagick.html with thanks to Michele. But again, the ImageMagick zips will not give you the C++/Magick++ headers or sub-directories.
For that you need to do the ImageMagick install from an exe and you can get this from: https://ftp.icm.edu.pl/packages/ImageMagick/binaries/ with many thanks to that institution. You need to select the C and C++ headers option as well as the legacy option during the installation.
You need to be extremely careful to install the correct/compatible versions in all cases as advised in Herb Miller's post.
By following this guidance exactly I managed to get one installation of ImageMagick with the PHP/Imagick and Magick++ functionality available.
Cheers
-
The MFC form does not use .NET whereas the VS2015/19 standard form constructs use .NET and that was what was preventing the cpprestsdk (Casablanca) communication with the back-end server on localhost. At least that is how I understand it.
Again, just FYI.
Cheers
-
Hi Larry, back in April I was looking for a way for a C++ front-end to 'communicate' with a PHP back-end with all functionality being on one PC? I.e., the implementation of PHP in my case would be via XAMPP.
On April 21st I reported that I had tried to use cpprestsdk (Casablanca) with a Windows Form via Visual Studio but that did not work.
But today I managed to get the functionality to work perfectly by developing the form with Microsoft Foundation Classes (MFC) which I had never used before :-) That took over 2 months - just as well that I am retired and have the time (and perseverance :-) The IDE was VS2015/19 Community Editions.
Just FYI, Cheers
-
Hi Larry,
Thanks as always for your interest and advice.
As an aside I had not used FLEX/WindowedApplication for a few years so I was a bit rusty but all OK again now. Referred to your FLEX and AIR books both of which I have. I now have the application working just fine on both Win7/PHP 5.6 and on a separate computer with Win 10 and PHP 7.1
Cheers from Oz, Necuima
-
P.S., The Flash program is a windowed FLEX application and as mentioned, this works perfectly with the called PHP scripts on XAMPP.
-
Hi Larry,
I am missing something. I select a file or a directory on my PC in a PHP script which includes an HTML form and within the form I use upload. Then on the redux pass I can move that file to a server location and do some stuff with it. No problem. But what I want to do is do some stuff to the file on the PC which I can do if I know the full path of the selected file. And in a slightly different PHP script I want to select a directory on my PC and get its full path so that I can then iterate over the files therein and do stuff to them.
What am I missing? And thank you as always.
Cheers
P.S., using a C++ front end or a Flash front-end program I can get the full path names of files and directories on my PC. Then, at least the Flash case, I can pass those data to a PHP back-end which nicely does what I want it to do for those selected files on my PC. I do not want this functionality for files on an external web-server.
-
Hi Larry,
FYI I installed cpprestsdk and associated it with Visual Studio 2019 and yes, a test C++ program successfully called and received a response from an external website.
BUT (isn't there often a BUT) when I tried to integrate the code that uses cpprestsdk into a Windows form application, I found out that they are incompatible!
Well, it was an interesting learning exercise :-)
As an aside, I found it quite tricky to install cpprestsdk but carefully following guidance courtesy Dr Google I eventually managed to get it installed and working with VS2019 (but not VS2017) in a Windows 10 PC.
Thanks for your interest.
Database Session Handler
in PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
Posted
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