function printTime() { echo(date("h:i:s")); } function pageModified() { $year = date("Y",getlastmod()); $mon = date("n",getlastmod()); $day = date("j",getlastmod()); if( $mon == "1") { $mon = "tammikuuta"; } else if( $mon == "2") { $mon = "helmikuuta"; } else if( $mon == "3") { $mon = "maaliskuuta"; } else if( $mon == "4") { $mon = "huhtikuuta"; } else if( $mon == "5") { $mon = "toukokuuta"; } else if( $mon == "6") { $mon = "kesäkuuta"; } else if( $mon == "7") { $mon = "heinäkuuta"; } else if( $mon == "8") { $mon = "elokuuta"; } else if( $mon == "9") { $mon = "syyskuuta"; } else if( $mon == "10") { $mon = "lokakuuta"; } else if( $mon == "11") { $mon = "marraskuuta"; } else if( $mon == "12") { $mon = "joulukuuta"; } echo("Tämä sivu on päivitetty " . $day . ". " . $mon . " " . $year . ".
"); } function printXMLTable($fname) { $xml = simplexml_load_file($fname); echo(""); echo(""); echo(""); echo(""); echo(""); echo(""); echo(""); foreach ($xml->butterfly as $bf) { echo(""); foreach ($bf->children() as $child) { echo(""); } echo(""); } echo("
"); echo("Suomenkielinen nimi:"); echo(""); echo("Tieteellinen nimi:"); echo(""); echo("Englanninkielinen nimi:"); echo(""); echo("Ruotsinkielinen nimi:"); echo("
"); echo($child); echo("
"); } function printCalender() { $today = getdate(); $firstDay = getdate(mktime(0,0,0,$today['mon'],1,$today['year'])); $lastDay = getdate(mktime(0,0,0,$today['mon']+1,0,$today['year'])); $firstwday = $firstDay['wday']; $lastwday = $lastDay['wday']; $currentdate = $today[mday]; if($firstwday == 0) { $firstwday = 7; } if($lastwday == 0) { $lastwday = 7; } $mon = $today['mon']; if( $mon == "1") { $mon = "Tammikuu"; } else if( $mon == "2") { $mon = "Helmikuu"; } else if( $mon == "3") { $mon = "Maaliskuu"; } else if( $mon == "4") { $mon = "Huhtikuu"; } else if( $mon == "5") { $mon = "Toukokuu"; } else if( $mon == "6") { $mon = "Kesäkuu"; } else if( $mon == "7") { $mon = "Heinäkuu"; } else if( $mon == "8") { $mon = "Elokuu"; } else if( $mon == "9") { $mon = "Syyskuu"; } else if( $mon == "10") { $mon = "Lokakuu"; } else if( $mon == "11") { $mon = "Marraskuu"; } else if( $mon == "12") { $mon = "Joulukuu"; } echo ''; echo ' "; echo ''; echo ' '; echo ' '; // Display the first calendar row with correct positioning echo ''; $actday = 1; for($i=1;$i<$firstwday;$i++) { echo ''; $actday++; } $dayindex=1; for($i=$actday;$i<=7;$i++) { if ($dayindex == $today['mday']) { $class = ' class="actday"'; } else { $class = ' class="numbers_td"'; } echo "$dayindex"; $dayindex++; } echo ''; //Get how many complete weeks are in the actual month $fullWeeks = floor(($lastDay['mday']-$dayindex)/7); for ($i=0;$i<$fullWeeks;$i++) { echo ''; for ($j=0;$j<7;$j++) { if ($dayindex == $today['mday']) { $class = ' class="actday"'; } else { $class = ' class="numbers_td"'; } echo "$dayindex"; $dayindex++; } echo ''; } //Now display the rest of the month if ($dayindex <= $lastDay['mday']) { echo ''; for ($i=0; $i<7;$i++) { if ($dayindex == $today['mday']) { $class = ' class="actday"'; } else { $class = ' class="numbers_td"'; } if ($dayindex <= $lastDay['mday']) { echo "$dayindex"; } else { echo ''; } $dayindex++; } echo ''; } echo '
'.$mon." - ".$today['year']."
MaTiKeToPeLaSu
 
 
'; } function loadForm() { $xmlName = "GuestBook.xml"; $xml = simplexml_load_file($xmlName); foreach ($xml->note as $notes) { foreach ($notes->children() as $child) { if($child->getName() == "comment") { echo("Viesti: "); echo($child); echo("


"); } else { echo("Nimi: "); echo($child); echo("
"); } } } } function saveForm() { $Name = $_POST["name"]; $Comment = $_POST["comment"]; $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name); $Comment = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comment); $Name = stripslashes($Name); $Comment = stripslashes($Comment); $xmlName = "GuestBook.xml"; $xml = simplexml_load_file($xmlName); $noteText = "" . $Name . "" . $Comment . ""; $xmlNoteNode = $xml->addChild("note"); $xmlNameNode = $xmlNoteNode->addChild("name",$Name); $xmlCommentNode = $xmlNoteNode->addChild("comment",$Comment); $xml->asXML("GuestBook.xml"); }