Skip to content

Instantly share code, notes, and snippets.

View wmandai's full-sized avatar
🏠
Working from home

William Mandai wmandai

🏠
Working from home
View GitHub Profile
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
@wmandai
wmandai / codeigniter-csrf
Created January 4, 2014 12:15
Codeigniter disable CSRF in specific pages
<?php
// Add this to your config.php file
if (stripos($_SERVER["REQUEST_URI"],'/controller/method') === FALSE) {
$config['csrf_protection'] = TRUE;
}else{
$config['csrf_protection'] = FALSE;
}
//the rest of the code
<?php
//check for referal links
function referal()
{
$CI =& get_instance();
$cookie_value_set = $CI->input->cookie('_tm_ref', TRUE) ? $CI->input->cookie('_tm_ref', TRUE) : '';
if ($CI->input->get('ref', TRUE) AND $cookie_value_set == '') {
// referred user so set cookie to ref=username
$cookie = array(
'name' => 'ref',