Tag: Code

HTTP Digest Authentication with PHP

The code for using HTTP Digest Authentication with PHP. <?php realm = ‘Restricted area’; if (empty(_SERVER[‘PHP_AUTH_DIGEST’])) { header(‘HTTP/1.1 401 Unauthorized’);…

Shutdown A Windows System from Command Line

ShutDown.EXE [/shutdown][/restart][/poweroff][/logoff][/lockws][/hibernate][/standby][/fshutdown][/frestart][/fpoweroff][/flogoff][/flockws][/fhibernate][/fstandby][/hide][/show] Switch      Description             Available for /shutdown   ShutDown Windows        Windows (all) /restart    Restart Windows         Windows (all) /poweroff   Power Off Windows      …

Find Difference Between 2 Dates in PHP

This function will find the difference between two given times. Does PHP already have a native function for that? //The…

Find the Fourth Sunday

Javascript code for finding the fourth sunday in any given month. function findFourthSunday(year,month) { var fourth_sunday = 0; var sunday_count…

Shortest way to create an XMLHttpRequest object

For best results use a framework – like jx http = window.XMLHttpRequest ? new window.XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject(“MSXML2.XMLHTTP”):…

Using PHP’s Curl functions behind a Proxy

Using PHP’s Curl functions even if the net is accessible only thru a proxy. This is the only way curl…