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 | |
function get_the_user_ip() { | |
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
//check ip from share internet | |
$ip = $_SERVER['HTTP_CLIENT_IP']; | |
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | |
//to check ip is pass from proxy | |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} else { |
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 | |
/** | |
* CodeIgniter | |
* | |
* An open source application development framework for PHP 5.2.4 or newer | |
* | |
* NOTICE OF LICENSE | |
* | |
* Licensed under the Open Software License version 3.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
<script> | |
$(document).ready(function(){ | |
if(window.console || "console" in window) { | |
console.log("%c WARNING!!!", "color:#FF8F1C; font-size:40px;"); | |
console.log("%c This browser feature is for developers only. Please do not copy-paste any code or run any scripts here. It may cause your PayPal account to be compromised.", "color:#003087; font-size:12px;"); | |
console.log("%c For more information, http://en.wikipedia.org/wiki/Self-XSS", "color:#003087; font-size:12px;"); | |
} | |
}); | |
</script> |
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 | |
$access_key = "iam-user-access-key"; //Access Key | |
$secret_key = "iam-user-secret-key"; //Secret Key | |
$my_bucket = "mybucket"; //bucket name | |
$region = "us-east-1"; //bucket region | |
$success_redirect = 'http://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; //URL to which the client is redirected upon success (currently self) | |
$allowd_file_size = "1048579"; //1 MB allowed Size | |
//dates |
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 | |
// Cache the contents to a file | |
$cached = fopen($cachefile, 'w'); | |
fwrite($cached, ob_get_contents()); | |
fclose($cached); | |
ob_end_flush(); // Send the output to the browser |
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 | |
namespace App; | |
class App | |
{ | |
public function __construct() | |
{ | |
$controller = new Controller\Example; | |
} |
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 | |
// | |
$view = new View(); | |
$view->addGlobal('global', 'Hello!, I\'m a Global var.'); | |
// in the method | |
echo $view->render('controller.method.phtml', ['var' => 'Hello World!']); |
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 | |
class View | |
{ | |
public function render( $view, array $data = [] ) | |
{ | |
ob_start() and extract($data, EXTR_SKIP); | |
try { |
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 | |
function getWeekDays() { | |
$time = strtotime( 'monday this week' ); | |
$days = []; | |
for($i = 0; $i<7; $i++){ | |
$d = new DateTime(); | |
$d->setTimestamp(strtotime("+$i day",$time)); | |
$days[] = $d->format("Y-m-d"); | |
} |
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 | |
namespace Slim; | |
use Pimple\Container; | |
trait ResolveCallable | |
{ | |
protected $container; |
NewerOlder