Tag Archives: PHP

Menupatch, Free Digital Signage

An evolution of the Student Notices V2 project, completely re-written again to allow for multiple user accounts, media uploads, and an algorithmic digital signage system.  This was released for free to complement the commercial Signchro product.

Notable Features:

  • Fully responsive layout using Bootstrap CSS.
  • Paypal API integration to keep track of accounts and payments.
  • Dedicated Digital Signage interface, with complex weighted calculations to use all available display face in the most optimal manner.
  • Media optimisation on upload to multiple sizes, for optimal display and bandwidth usage throughout.
  • UUID based database and file storage.
  • DOM manipulation for Multi-use Modals.
  • MVC framework for ease of maintenance.

Configuring phpmyadmin with nginx

Install the php dependencies

apt-get install phpmyadmin php5-fpm

Modify /etc/nginx/sites-available/default and add the following at the end of the server section

location ^~ /phpmyadmin {
    alias /usr/share/phpmyadmin/;
    index index.php index.html index.htm;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

To restrict access to a certain IP, add the following just below the index line that you have just added…

allow 127.0.0.1;
allow 1.2.3.4;
deny all;

enable mcrypt extension

php5enmod mcrypt

restart nginx & php5

service restart nginx
service restart php5-fpm

Enable cross-origin resource sharing for AJAX

A common problem when dealing with AJAX scripts is that the server script (or API) which javascript is calling is required to be on exactly the same domain (subdomain included).  To open up your server script / API to all domains the following headers are required to be sent before any content:

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With

In PHP the code would be:

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With');

If you are using a single script that contains both the API and the regular page (even with includes), the headers must be sent before it is determined whether it is an API call or not.  This is due to a ‘pre-flight request‘ the browser does to test that the impending AJAX call is all approved and above board.  Once it receives the a-ok it will do a second call with the full AJAX credentials.

Installing HHVM on Amazon Linux (AWS)

HHVM

Alternative to PHP, said to increase speed by up to 40%.  Works similar to java in that it pre-compiles PHP automatically to speed up execution time.  Used by facebook.

cd /etc/yum.repos.d
wget http://www.hop5.in/yum/el6/hop5.repo
echo 'priority=9' >> hop5.repo
echo 'includepkgs=glog,tbb' >> hop5.repo
wget http://yum.sexydev.com/sexydev-amazon.repo
yum install hhvm

 

Social Network

This was a complex social network platform which was heavily based on nested reusable functions.  After 5 months of development it was discovered it was no longer what the client was after, and the project was ended.

  • API hooks with flickr, youtube/google
  • Advanced templating engine allowing on-the-fly modification of CSS rules
  • Real-time efficient multiple thumbnail engine from uploaded & linked media
  • Highly recursive branched functions
  • Customised tools were also developed for the staff.

Some of the technologies used were:

  • google / youtube api
  • flickr api
  • dojo
  • ajax
  • javascript
  • css
  • html5
  • php / codeigniter / MVC
  • mysql
  • ubuntu server
  • bash scripting
  • rsync backups

Due to the policies of the project manager, no screenshots are available.

Daily Updates Console

Daily Updates console is a streamlined version of one that was existing.  Previously staff had to edit through an old perl-based web interface which wasn’t user friendly or intuitive (required training), had many unnecessary steps, and sent all the information at 3am at night.  The new console solved all of these problems with the following changes:

  • bringing the backend & frontend in to modern web technologies (dojo, php)
  • separated the editing in to logical sections (sports, news, weather) and in logical order
  • combined the editing (left column) and web preview (right column) in to one single interface rather than across two browser windows – bringing the content to the staff member as opposed to them having to find it
  • built the transfer script in to the interface itself so staff would not need any command line training/access and could send as soon as the data was input.

The result cut editing times in half & allowed for multiple staff to take on the task with almost no learning curve.

Offer Soup

Built during the “Daily Deals” craze, this site scalped the big daily deal sites for what was going on at any time – allowing for a client to visit just one site rather than 10 or 20.  It had an intelligent updating & caching system where it would update only once every 30 minutes if someone was visiting, allowing for cron-less operation.

It is no-longer in operation.