Skip to content

Instantly share code, notes, and snippets.

View chtombleson's full-sized avatar

Christopher Tombleson chtombleson

View GitHub Profile

Keybase proof

I hereby claim:

  • I am chtombleson on github.
  • I am chtombleson (https://keybase.io/chtombleson) on keybase.
  • I have a public key whose fingerprint is 2136 8EFB D8B5 B73C 2A76 4736 CBA7 BC10 9BF9 DCFE

To claim this, I am signing this object:

@chtombleson
chtombleson / Sanitise.php
Created October 27, 2014 21:18
Raw PHP sanitisation class
class Sanitise
{
public function get($name, $filter, $options=null)
{
return $this->sanitise(INPUT_GET, $name, $filter, $options);
}
public function post($name, $filter, $options=null)
{
return $this->sanitise(INPUT_POST, $name, $filter, $options);
@chtombleson
chtombleson / UserInput.php
Created April 6, 2014 06:10
Helper Class for sanitizing user input in PHP
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Christopher Tombleson <chris@cribznetwok.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@chtombleson
chtombleson / sanitize.php
Created April 6, 2014 02:02
PHP sanitize function.
<?php
function get_param($key, $filter=FILTER_SANITIZE_STRING) {
if (!isset($_GET[$key])) {
return null;
}
return filter_var($_GET[$key], $filter);
}
function post_param($key, $filter=FILTER_SANITIZE_STRING) {
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
@chtombleson
chtombleson / silverstripe.conf
Created January 30, 2014 07:04
Silverstripe nginx config
server {
listen 80;
server_name example.com;
root /var/www/example.com;
error_log /var/log/example.com/error.log;
access_log /var/log/example.com/access.log;
location / {
try_files $uri @silverstripe;
}