View get_the_user_ip.php
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 { |
View Security.php
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 | |
* |
View warning.html
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> |
View direct-upload-aws-s3.php
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 |
View bottom-cache.php
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 |
View App.php
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; | |
} |
View Model.php
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!']); |
View View.php
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 { |
View getWeekDays.php
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"); | |
} |
View ResolveCallable.php
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