Skip to content

Instantly share code, notes, and snippets.

<?php
/* Emulate register_globals behavior:
*
* @see http://php.net/manual/en/ini.core.php#ini.variables-order
*
* If variables_order is set to "EGPCS", and both $_GET['action'] and
* $_POST['action'] are set, then $action will contain the value of
* $_POST['action'] as P comes after G in our example directive value.
*
* @param bool $include_session Whether to register session variables or not.
@adduc
adduc / gist:8907811
Created February 9, 2014 23:34
Logwatch for PHP excluding referer information
#!/usr/bin/perl -w
#
# $Id$
#
# Logwatch service for php error logs
# To be placed in
# /etc/logwatch/scripts/php
#
# Processes all messages and summarizes them
# Each message is given with a timestamp and RMS
@adduc
adduc / gist:7489154
Last active December 28, 2015 10:49
Phing target for detecting PHP short open tags.
<target name="checkshorttags">
<!-- Run in parallel to speed up process. -->
<exec
escape="false"
command='GREPOUT=`find . -not -ipath "*vendor*" -type "f" -name "*.php" -print0 | xargs -0 -n1 -P$(nproc) pcregrep -nrHMe "&lt;\?\s"`;
echo "$GREPOUT";
if [ -z "$GREPOUT" ];
then exit 0;
else exit 1;
fi;