Skip to content

Instantly share code, notes, and snippets.

@sylae

sylae/.htaccess Secret

Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylae/cdb9d6ff99d7b47fb83f to your computer and use it in GitHub Desktop.
Save sylae/cdb9d6ff99d7b47fb83f to your computer and use it in GitHub Desktop.
RewriteEngine On
RewriteBase /swav
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
<?php
preg_match('/\/swav\/[\D.]+(\d*).+/', $_SERVER['REQUEST_URI'], $matches);
$pic = $matches[1] % 207;
$pics = array();
foreach (glob("/var/www/calref-new/chat/emoticon-packs/ponicons/*.png") as $filename) {
// the above path should point to the proper directory in calref/cadence
$pics[] = $filename;
}
header("Content-Type: image/png");
// 5482 sy
// 2001 aran
if ($matches[1] == 5482) {
echo file_get_contents("/var/www/calref-new/chat/emoticon-packs/ponicons/sybeam.png");
} elseif ($matches[1] == 2001) {
echo file_get_contents("/var/www/calref-new/chat/emoticon-packs/ponicons/aran.png");
} else {
echo file_get_contents($pics[$pic]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment