$status_message = ''; // Status messages, default to nothing $r = new Record(); $r->auth(null); $r->init(WEB::_get('id')); // Populate Genre Select List $g = new Genre(); $genreList = $g->getGenreAsSelect(); // Populate Band Select List $bd = new Band(); $bandList = $bd->getBandAsSelect(); if (!$r->valid()) { $status_message = WEB::_error('Record couldn\'t be viewed. Check ID #!', null); } // Handle Post Request if (WEB::_req('POST')) { $msg = WEB::_imageUpload($_FILES['image']); if (!array_key_exists('error', $msg)) { $band_id = WEB::_post('band_id'); $record_current_value = WEB::_post('record_current_value'); $record_size = WEB::_post('record_size'); $record_original_price = WEB::_post('record_original_price'); $record_release_date = WEB::_post('record_release_date'); $record_name = WEB::_post('record_name'); $record_description = WEB::_post('record_description'); $record_condition = WEB::_post('record_condition'); $record_length = WEB::_post('record_length'); $genre_id = WEB::_post('genre_id'); $record_artwork = $msg['file_path']; // array($band_id, $record_current_value, $record_size, $record_original_price, $record_release_date, // $record_name, $record_description, $record_condition, $record_length, $genre_id, $record_artwork)
<?php require_once __DIR__ . '/libs/bourbon.php'; $b = new Bourbon(); function cidr_match($ip, $range) { list($subnet, $bits) = explode('/', $range); $ip = ip2long($ip); $subnet = ip2long($subnet); $mask = -1 << 32 - $bits; $subnet &= $mask; # nb: in case the supplied subnet wasn't correctly aligned return ($ip & $mask) == $subnet; } // Make sure either an authenticated user or GitHub is running this script if (!WEB::_req('POST')) { $b->auth(null); } else { if (!cidr_match($_SERVER['REMOTE_ADDR'], '192.30.252.0/22')) { header('Location: ' . realpath() . '/index.php'); } } /** * GIT DEPLOYMENT SCRIPT * * Used for automatically deploying websites via github or bitbucket, more deets here: * * https://gist.github.com/1809044 */ // The commands $commands = array('echo $PWD', 'whoami', 'git pull', 'git status', 'git submodule sync', 'git submodule update', 'git submodule status', 'mysqladmin -uroot -proot -f drop bourbon', 'mysqladmin -uroot -proot -f create bourbon', 'mysql -uroot -proot bourbon < /srv/cpsc471-bourbon/sql/latest.sql');