Update the data in a select2 widget when another select2 widget changes.
Select multiple related records and add new related records using Select2.
Manage multiple child models in a form, supporting validation for each model.
Manage multiple models in a form, supporting validation for each model.
Use CloudFlare API to automatically block attacking IP addresses from visiting your server.
MrPHP.com.au has been unlatched from the shackles of, Drupal7, to a much nicer responsive theme using the new Twitter Bootstrap 3.
We’re now powered by GitHub Pages. That’s right, no PHP on MrPHP.com.au.
Just getting some code out of my wiki. The Google Maps API part won’t work, but there is some nice distance functions and the overall concept is fine. Just needs an update on the Google Maps API.
By default, if an anonymous user comments on some content in your drupal site, your comments box will show something like Submitted by Guest (not verified). The user may have left a username, so we would like to use that instead.
Server was running up super high load thanks to php5’s cron task.
That's right! MrPHP.com.au has officially upgraded from that 2000's feeling theme, powered by Drupal6, to a much nicer web 2.0 feeling theme powered by Drupal7 and Twitter Bootstrap.
This is a fantastic function that will allow you to cache your data. By default it will cache using memcache, however if you do not have memcache installed or a connection cannot be achieved it will fall back to file based cache.
The single function supports cache read, cache write, cache clear key and cache clear all. The cached data can be given an expirey time so that your data does not become stale.
Usage is very simple and the performance results of caching using memcache are fantastic.
I have a domain where I keep all my pictures and I would like to be able to use multiple domains to access those images.
“Well that’s easy”, I hear you saying. “Just use parked or addon Domains”.
Yes that’s a fantastic solution… Unless you need to have an SSL certificate on the site. The problem is that you can only install 1 SSL certificate per site, and the SSL certificate must match only one domain name.
Quick code snippet, just drop this into clearcache.php and then load it in your browser.
A problem that I have faced with SQL many times is pre-ordering the
GROUP BY clause.
When you GROUP BY, MySQL will return a set of records which I call representing records. These records represent the group that is selected.
select id from test group by class will return one representing record per unique value of the
class field. The problem with this is that you have no control over which record will represent the group.
If you understand the potential security risks but you still need to run PHP with register_globals ON there are a couple of ways to do it.
If you have access to the servers php.ini then its fairly easy, however if you don’t have access to that file or if you are not willing to make this change server wide then there are other ways to go about it.
Every time I install Memcache on cPanel I get a little bit stuck, so I wrote this quick guide in the hopes of helping myself next time and also helping other people who want the advantages of super fast caching.
This is a quick 1 page application to monitor your replicated MySQL servers.
Use it as you will. Enjoy!