This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$book = file_get_contents('book.txt'); | |
$book = strtolower($book); | |
$book = str_replace(array('.', ',', ':', ';', '"', "'", '?', '!', '-', '`'), '', $book); | |
$words = explode(' ', $book); | |
$stats = array_count_values($words); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = R::dispense(‘user’); | |
$user->login = ‘legierski’; | |
$user->password = ‘H4XX0RP4SSW0RD’; // with salts, encryptions and all that fancy stuff | |
R::store($user); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = R::dispense(‘user’); | |
$user->email = ‘[email protected]’; // that’s all it takes | |
$user->login = ‘legierski’; | |
$user->password = ‘H4XX0RP4SSW0RD’; | |
R::store($user); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
am_i_logged_in_interval = setInterval("am_i_logged_in()", 60000); | |
}); | |
function am_i_logged_in() { | |
address = window.location.protocol+'//'+window.location.hostname+'/am-i-logged-in'; | |
$.ajax({ | |
type: "POST", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function am_i_logged_in() { | |
if(!IS_AJAX) { | |
echo 'Hi there!<br><br>In case you were wondering - the address that you\'ve just visited is used by us to check if you\'re still logged into GatherContent, and if, by any chance, your browser logs you out - we will display information within the app to prevent data loss!'; | |
exit; | |
} | |
$json = array(); | |
if(!$u = Current_User::user()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
if ( ! function_exists('force_download2')) | |
{ | |
function force_download2($filename = '', $data = '') | |
{ | |
if (FALSE === strpos($filename, '.')) | |
{ | |
$filename .= '.noextension'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$spaces = calculate_spaces('folder-name'); | |
echo 'Spaces and tabs used for indentation account for '.$spaces['percent'].'% of selected folder\'s files ('.$spaces['spaces'].' spaces, '.$spaces['total'].' total characters).'; | |
function calculate_spaces($path) { | |
$spaces_counter = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(file_exists('.production')) { | |
define('ENVIRONMENT', 'production'); | |
} | |
else if(file_exists('.development')) { | |
define('ENVIRONMENT', 'development'); | |
} | |
else { | |
exit('Missing .production/.development file.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* | |
* ------------------------------------------------------ | |
* Set a liberal script execution time limit | |
* ------------------------------------------------------ | |
*/ | |
if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0) | |
{ | |
@set_time_limit(300); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function foreach_safe($arr) { | |
if(is_array($arr)) { | |
if(count($arr) > 0) { | |
return true; | |
} | |
} | |
return false; |
OlderNewer