
PHP returning wrong date
From time to time we are working on small campaigns, where competition starts at given time. Because in Australia we have “so many” timezones, it’s critical to set things correctly according to the time zone.
From time to time we are working on small campaigns, where competition starts at given time. Because in Australia we have “so many” timezones, it’s critical to set things correctly according to the time zone.
There is a website, with iframe. I frame source is correct, but won’t display content of the website. No visible errors. There only small detail in the console:
Load denied by X-Frame-Options: https://... does not permit cross-origin framing.
Some crazy admin figure out that it’s going to be better… and put some crazy code into headers:
X-Frame-Options: SAMEORIGINX-XSS-Protection: 1; mode=blockX-Content-Type-Options: nosniff
Solution: talk to the hand, because admin won’t listen ;P
When you start looking for a solution, you will find answers like using Cloudfront, lambda, and middleware 3rd party services. And basically, you don’t have any other choice. There is no simple solution to your problem. But – as long as you use Caddy Server solution is super easy.
list of Australian postcodes by the state
I recently worked on a project with a super dull address form. I figured out that we need to help poor users fill tedious forms, so I made a little code snippet/function which gets the postcode and returns the state. I took postcode ranges from wikipedia , so blame them if something isn’t working as expected.
Small 2019 update – Please check out this library – github.com/maxmind/MaxMind-DB-Reader-php
It’s a straight replacement of PHP module.
GeoIP extensions is quite use-full, but it requires some server – side magic. If you are looking for something simpler, just go with ipstack.com or something similar – GeoIP .
Otherwise:
wget http://pear.php.net/go-pear.phar
php go-pear.phar
We need geoip-devel libraries:
yum install geoip-devel
And newest (not stable) version of geoip:
sudo ./pecl install geoip-1.1.1
Don’t forget to add extension=geoip.so
to your php.ini file.