- In the extension bar, click the AdBlock Plus icon
- Click the large blue toggle for this website
- Click refresh
- In the extension bar, click the AdBlock icon
- Under "Pause on this site" click "Always"
- In the extension bar, click on the Adguard icon
- Click on the large green toggle for this website
- In the extension bar, click on the Ad Remover icon
- Click "Disable on This Website"
- In the extension bar, click on the orange lion icon
- Click the toggle on the top right, shifting from "Up" to "Down"
- In the extension bar, click on the Ghostery icon
- Click the "Anti-Tracking" shield so it says "Off"
- Click the "Ad-Blocking" stop sign so it says "Off"
- Refresh the page
- In the extension bar, click on the uBlock Origin icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the uBlock icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the UltraBlock icon
- Check the "Disable UltraBlock" checkbox
- Please disable your Ad Blocker
- Disable any DNS blocking tools such as AdGuardDNS or NextDNS
- Disable any privacy or tracking protection extensions such as Firefox Enhanced Tracking Protection or DuckDuckGo Privacy.
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
Quboid
I have a PHP script that runs twice for a certain (very important) user. I can not get it to run twice, even using the same browser. Unfortunately, I can't link to it here.
The script is part of a newsletter system I've been writing. In this particular section (actually creating and sending the letter) there are 3 pages - the first is where the administrator enters the subject, the newsletter and the category or categories of subscribers that it is to sent to. They then click on send and they got a confirmation page. This shows how many members are in the categories they selected and an overview of the letter. If they're happy, they then click on Confirm and the final script loops, going through the database and gets the details for each subscriber (name, email address, etc), personalizes it for that subscriber and sends off the email. The problem is that the final script will execute twice for a particular administrator, sending everyone two emails.
I've done some sniffing at log files and found that it is executed twice, rather than some bug making a large part of my script get looped twice. Interestingly, the first execution has the HTTP_REFERER set correctly to the confirmation page. The second call has no HTTP_REFERER set. The time difference between the 2 scripts being run is 0 seconds (all the logs are precise to just 1 second). I'm pretty sure the admin isn't calling it twice. I put in javascript to disable the submit button after it's clicked much like this board has for the reply button (in fact, very much like what this board has :shifty: ). Also, the HTTP_REFERER isn't set for the second execution when it should be. The fact that it is set for the first one shows that it is indeed working (I know thisn't 100% reliable). The newsletter details are passed on both executions (via POST).
I've helped the issue somewhat but it's treating symptoms, not the cause. The submit disabler failed completely but more successful is the anti-dup system I implemented. Each sent letter is saved for future viewing along with the time it was send - before running the main read member info/send email loop, I checked the saved messages for one with the same subject, body and any of the same subscriber categories that have been sent in the last 30 mins and quit with an error message if any are found. It works, but I'd like to fix it properly.
Link to comment
https://www.neowin.net/forum/topic/106107-php-script-executing-twice-for-no-apparent-reason/Share on other sites
2 answers to this question
Recommended Posts