Document Onload

if (window.attachEvent) {window.attachEvent('onload', your_function);}
else if (window.addEventListener) {window.addEventListener('load', your_function, false);}
else {document.addEventListener('load', your_function, false);}

Js Cookie

function ddtSetCookie(c_name,value,exdays){
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays==null) ? "" : "; expires=" + exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}

function ddtGetCookie(c_name){
var i,x,y,ARRcookies=document.cookie.split(";");
for(i = 0; i<ARRcookies.length; i++){
x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
x = x.replace(/^s+|s+$/g,"");
if(x == c_name) return unescape(y);
}
}

Remember scroll position

////////////////////////////////
// fixscroll.js:
// call loadP and unloadP when body loads/unloads and scroll position will not move
function getScrollXY() {
var x = 0, y = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
// Netscape
x = window.pageXOffset;
y = window.pageYOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
// DOM
x = document.body.scrollLeft;
y = document.body.scrollTop;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
// IE6 standards compliant mode
x = document.documentElement.scrollLeft;
y = document.documentElement.scrollTop;
}
return [x, y];
}

function setScrollXY(x, y) {
window.scrollTo(x, y);
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function loadP(pageref){
x=readCookie(pageref+'x');
y=readCookie(pageref+'y');
setScrollXY(x,y)
}
function unloadP(pageref){
s=getScrollXY()
createCookie(pageref+'x',s[0],0.1);
createCookie(pageref+'y',s[1],0.1);
}

Temp Directory

function tempdir(){
$tempfile = tempnam('','');
if(file_exists($tempfile)) {unlink($tempfile); }
mkdir($tempfile);
if(is_dir($tempfile)){ return $tempfile; }
}

Poor mans trust seal starter

<!-- Add this link to the page to display the seal -->

<script type="text/javascript" src="http://myhyperspace.com/seal.php?host_name=testing.myhyperspace.com"></script>

<?php //Add this to the file on the trust seal site pooled when loading verified sites

$accepted_host_name = 'testing.myhyperspace.com';//For example only the below conditional would be a check to the database using referer domain name

$referring_domain = parse_url($_SERVER['HTTP_REFERER']);

if($referring_domain['host'] == $accepted_host_name) echo 'document.write("Domain Verified");';//Serve seal image instead of text
else echo 'document.write("Denied, not the right domain");'; //Serve not verified image or something of the sort here

?>

Temp Zip for Download

<?php

$file = tempnam("tmp","zip");
$zip = new ZipArchive();
$zip->open($file,ZipArchive::OVERWRITE);

//Throw an extra file in dynamically
$dynamic_content = 'This is the README file that comes with your downloaded zip. Waka Waka';
$zip->addFromString('readme.txt', $dynamic_content);

//Include files in archive
$zip->addFile('testfile.txt', 'testfile.txt');
$zip->addFile('testfile2.txt', 'testfile2.txt');

$zip->close();

header('Content-Type: application/zip');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename="myzippedfiles.zip"');

readfile($file);
unlink($file);

?>

File exists for webdav

function fileExists($path){
return (@fopen($path,"r")==true);
}

$filename = 'http://pathtoafile.php';
if(fileExists($filename)) echo 'Exists';
else echo 'sorry, come again';