All pastes #429403 Raw Edit

Someone

public php v1 · immutable
·published 2007-04-08 06:09 UTC
rendered paste body
<?phpif(!isset($_POST['submit'])){ ?><html><head><script language="javascript">function addLoadEvent(func) {    var oldonload = window.onload;    if (typeof window.onload != 'function') {        window.onload = func;    } else {        window.onload = function() {            if (oldonload) {                oldonload();            }            func();        }    }}function DateSelector(start, end){	var startYear = start;	var endYear = end;		var monthField;	var dateField;	var yearField;		var months = new Array();	months[0]=new Option("January",31);	months[1]=new Option("February",28);	months[2]=new Option("March",31);	months[3]=new Option("April",30);	months[4]=new Option("May",31);	months[5]=new Option("June",30);	months[6]=new Option("July",31);	months[7]=new Option("August",30);	months[8]=new Option("September",30);	months[9]=new Option("October",31);	months[10]=new Option("November",31);	months[11]=new Option("December",30);		this.update_days = function()	{		document.getElementById(dateField).innerHTML = "";		for(var i = 1; i <= getDaysInMonth(); i++)		{			document.getElementById(dateField).appendChild(createOption(i,i));		}	}		this.registerMonthField = function(id)	{		monthField = id;		for(var i = 0; i < 12; i ++)		{			document.getElementById(id).appendChild(createOption(i+1, months[i].text));		}		document.getElementById(id).onchange = this.update_days;	}		this.registerDateField = function(id)	{		dateField = id;	}		this.registerYearField = function(id)	{		yearField = id;		for(var i = startYear; i <= endYear; i++)		{			document.getElementById(id).appendChild(createOption(i,i));		}		document.getElementById(id).onchange = this.update_days;	}		this.initialize = function()	{		this.update_days();	}		function createOption(value, text)	{		var option = document.createElement('option');		option.setAttribute('value', value);		option.appendChild(document.createTextNode(text));		return option;	}		function determineIfLeap(year)	{		result = false;		if(year % 400 == 0)			result = true;		else if(year % 100 == 0)	result = false;		else if(year % 4 == 0)		result = true;		return result;	}		function getDaysInMonth()	{		var days;		if(determineIfLeap(document.getElementById(yearField).value) && document.getElementById(monthField).value == 2)		{			days = 29;		} else {			days = months[document.getElementById(monthField).value - 1].value;		}		return days;	}}</script></head><body><form name="philsDate" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">	<select name="birthMonth" id="birthMonth"></select>	<select name="birthDate" id="birthDate"></select>	<select name="birthYear" id="birthYear"></select>	<script language="javascript">		birthDate = new DateSelector(1950, 2000);		birthDate.registerMonthField("birthMonth");		birthDate.registerDateField("birthDate");		birthDate.registerYearField("birthYear");		birthDate.initialize();	</script>	<input type="submit" name="submit" value="Submit Date" /></form></body></html><?php} else {echo '<pre>';print_r($_POST);}?>