Skip to content

Instantly share code, notes, and snippets.

View DaveRandom's full-sized avatar

Chris Wright DaveRandom

View GitHub Profile
@DaveRandom
DaveRandom / login.php
Created August 19, 2018 16:59 — forked from rahuldottech/login.php
PHP session management
<?php
require 'secsesh.php';
session_start();
if(/*credentials check out*/){
s_start();
}
header( 'Location: somePage.php' );
@DaveRandom
DaveRandom / client.php
Last active September 9, 2021 19:58 — forked from ikariiin/server.php
<?php declare(strict_types = 1);
function send_data($socket, $data)
{
echo "Sending data {$data}\n";
fwrite($socket, $data);
$response = fread($socket, 1024);
echo "Got response: {$response}\n";
}
array(97) { ["PROCESSOR_ARCHITEW6432"]=> string(5) "AMD64" ["_FCGI_X_PIPE_"]=> string(53) "\\.\pipe\IISFCGI-c9b24bea-eef1-4a1d-b0a5-a94ab18c4deb" ["PHP_FCGI_MAX_REQUESTS"]=> string(5) "10000" ["PHPRC"]=> string(31) "C:\Program Files (x86)\PHP\v5.3" ["ALLUSERSPROFILE"]=> string(14) "C:\ProgramData" ["APPDATA"]=> string(56) "C:\Windows\system32\config\systemprofile\AppData\Roaming" ["APP_POOL_CONFIG"]=> string(51) "C:\inetpub\temp\apppools\SingleRTB\SingleRTB.config" ["APP_POOL_ID"]=> string(9) "SingleRTB" ["CommonProgramFiles"]=> string(35) "C:\Program Files (x86)\Common Files" ["CommonProgramFiles(x86)"]=> string(35) "C:\Program Files (x86)\Common Files" ["CommonProgramW6432"]=> string(29) "C:\Program Files\Common Files" ["COMPUTERNAME"]=> string(15) "WIN-IAHBJGOU4S1" ["ComSpec"]=> string(27) "C:\Windows\system32\cmd.exe" ["FP_NO_HOST_CHECK"]=> string(2) "NO" ["JRE_HOME"]=> string(32) "C:\Program Files (x86)\Java\jre7" ["LOCALAPPDATA"]=> string(54) "C:\Windows\system32\config\systemprofile\AppData\Local" ["NU
<?php
//echo dirname(__FILE__);
$curl = curl_init('https://mydomain.com/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_CERTINFO, true);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_STDERR, fopen('php://output', 'w'));
@DaveRandom
DaveRandom / oadate.php
Last active July 19, 2017 07:53 — forked from seanbamforth/oadate.php
PHP OADate formatting - To and From...
<?php
class OLEAutomationDateConverter
{
/**
* Get the OLE Automation Date epoch
*
* @return DateTimeImmutable
*/
public static function BaseDate()
<?php
namespace Seedstream;
use React\EventLoop\LoopInterface,
React\Socket\ConnectionInterface;
class HandlerManager
{
private $loop;
@DaveRandom
DaveRandom / Pusher.php
Last active December 24, 2015 15:49 — forked from J7mbo/gist:6823472
<?php
namespace Seedstream;
use React\EventLoop\LoopInterface,
React\Socket\ConnectionInterface;
class Pusher
{
private $loop;
<?php
// Because PHP_URL_* constants are sequential :-(
const URL_SCHEME = 0x01;
const URL_USER = 0x02;
const URL_PASS = 0x04;
const URL_HOST = 0x08;
const URL_PORT = 0x10;
const URL_PATH = 0x20;
const URL_QUERY = 0x40;
[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

[**Please, don't use `mysql_*` functions in new code**](http://stackoverflow.com/q/12859942). They are no longer maintained [and are officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). See the [**red box**](http://php.net/mysql-connect)? Learn about [*prepared statements*](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://php.net/mysqlinfo.api.choosing) will help you decide which. If you choose PDO, [here is a good tutorial](http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers).

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or [MySQLi](http://php.net/mysq