Skip to content

Instantly share code, notes, and snippets.

View ruslanchek's full-sized avatar
🎯
Focusing

Mike Burton ruslanchek

🎯
Focusing
View GitHub Profile
@ruslanchek
ruslanchek / db
Created October 25, 2012 16:46
DB PHP
<?php
class Database extends Core {
private
$link,
$db_vars,
$enconing = 'utf8';
public function __construct($host, $db, $user, $pass){
$this->db_vars = new stdClass();
@ruslanchek
ruslanchek / nodejs
Created September 24, 2012 13:02
node.js init.d script for CentOS
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@ruslanchek
ruslanchek / antiddos.php
Created August 5, 2012 21:42
Litle DDoS hack :-)
<?PHP
if((!isset($_COOKIE) || !isset($_GET['r'])) || $_GET['r'] != $_COOKIE['r']){
$rnd = md5(mt_rand());
if($_SERVER['QUERY_STRING'] && !$_GET['r']){
$s = '?' . $_SERVER['QUERY_STRING'] . '&r='.$rnd;
}else{
$s = '?r='.$rnd;
};
<?php
function showOAuthError($error, $error_description){
if($error == 'access_denied'){
header("Location: http://".$_SERVER['HTTP_HOST']);
}else{
$error = '<strong>Error: '.$error.'</strong>
<p>'.preg_replace('/\+/', ' ', $error_description).'</p>';
die($error);
};