Skip to content

Instantly share code, notes, and snippets.

<?php
if(isset($_POST['source'])) {
$source = $_POST['source'];
if(isset($_POST['type']) && 'php' == $_POST['type']) {
$code = highlight_string($source, true);
$output = $code;
} else {
$code = htmlentities($source);
@SaltwaterC
SaltwaterC / .gitignore
Created March 27, 2012 12:31 — forked from necenzurat/cache.php
php cache curl
/cache/
@mebcomputers
mebcomputers / gist:2550712
Created April 29, 2012 14:21
php: create visitor log file
<?php
class log {
public $filename;
public $timestamp;
public $ip;
public $u_agent;
public $u_refer;
public $ub;
@art2code
art2code / gist:2584441
Created May 3, 2012 08:48
php: check if js and cookie enabled
<?php
ob_start();/* header buffer */
session_start();
### Make cookies if they don't exist #######################
if(!$_SESSION['exists']){
$_SESSION['exists']= 'off';
setcookie("exits", "data");
}
### Test for $_SESSION cookies being enabled ##############
@taterbase
taterbase / upload.php
Created May 13, 2012 15:03
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@kivlor
kivlor / codepen.php
Last active September 17, 2021 23:22
PHP Code Pen
<?php
/*
This is a very dirty implementation of a 'code pen' for quickly testing small snippets of PHP code.
- It will eval anything and everything entered into the code field
- It should only ever be used on a local machine, never on the dev servers and espiacally never on a live server
USE WITH CAUTION!
@codler
codler / gist:3906826
Created October 17, 2012 17:18
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
@plepe
plepe / webadmin.php
Last active March 12, 2025 06:23
webadmin.php is a simple Web-based file manager.
<?php
// source: http://cker.name/webadmin/
/*
* webadmin.php - a simple Web-based file manager
* Copyright (C) 2004-2011 Daniel Wacker [daniel dot wacker at web dot de]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@lmammino
lmammino / curlStreamedDownload.php
Created December 21, 2012 15:15
Download a large file (streaming) with php and curl extension
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
<script type="text/javascript" src="//cdn.jsdelivr.net/jwplayer/5.10/jwplayer.js"></script>
<div id="player_1"></div>
<script type="text/javascript">// <![CDATA[
jwplayer('player_1').setup({
file: "http://testing.grappler.tk/files/2013/01/trailer_1080p.mp4",
width: "100%",
height: "100%",
stretching: "fill",
flashplayer:"//cdn.jsdelivr.net/jwplayer/5.10/player.swf"
});