Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

  1. <%@ LANGUAGE = PerlScript%>
  2. <HTML>
  3. <HEAD>
  4. <!--
  5. Copyright (c) 1996, Microsoft Corporation. All rights reserved.
  6. Developed by ActiveState Internet Corp., http://www.ActiveState.com
  7. -->
  8. <TITLE> Fibonacci numbers through 17 </TITLE>
  9. </HEAD>
  10. <BODY> <BODY BGCOLOR=#FFFFFF>
  11. <!--
  12. ActiveState PerlScript sample
  13. PerlScript: The coolest way to program custom web solutions.
  14. -->
  15. <!-- Masthead -->
  16. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  17. <TR VALIGN=TOP ><TD WIDTH=400>
  18. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
  19. </TD></TR></TABLE>
  20. <FONT SIZE=3>
  21. Date/time: <%
  22. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
  23. $thisday=(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)[$wday];
  24. $thismon=(January,February,March,April,May,June,July,August,September,October,November,December)[$mon];
  25. $time = sprintf '%2.2d:%2.2d:%2.2d',$hour,$min,$sec;
  26. $year += 1900;
  27. $datetime = $thisday.', '.$thismon.' '.$mday.', '.$year.' '.$time;
  28. $Response->write($datetime);
  29. %><BR>
  30. </font>
  31. <HR>
  32. <%$N = 17;%>
  33. <H1>Fibonacci numbers through <%= $N %></H1><BR>
  34. Computations done via function calls<BR>
  35. <TABLE BORDER>
  36. <%for ($i = 0; $i<$N; $i++){%>
  37. <TR>
  38. <TD ALIGN=RIGHT><FONT SIZE=1> <%=$i%> </font></TD>
  39. <TD ALIGN=RIGHT><FONT SIZE=2> <%$Response->write(&Fibonacci($i));%> </font></TD>
  40. </TR>
  41. <%}%>
  42. </TABLE>
  43. <%sub Fibonacci
  44. {
  45. local $i=$_[0];
  46. local $fibA = 1;
  47. local $fibB = 1;
  48. if ($i == 0)
  49. {
  50. return $fibA;
  51. }
  52. elsif ($i == 1)
  53. {
  54. return $fibB;
  55. }
  56. elsif ($i > 1)
  57. {
  58. for ($j = 2; $j<=$i; $j++)
  59. {
  60. $fib = $fibA + $fibB ;
  61. $fibA = $fibB ;
  62. $fibB = $fib;
  63. }
  64. return $fib;
  65. }
  66. } %>
  67. <!-- +++++++++++++++++++++++++++++++++++++
  68. here is the standard showsource link -
  69. Note that PerlScript must be the default language --> <hr>
  70. <%
  71. $url = $Request->ServerVariables('PATH_INFO')->item;
  72. $_ = $Request->ServerVariables('PATH_TRANSLATED')->item;
  73. s/[\/\\](\w*\.asp\Z)//m;
  74. $params = 'filename='."$1".'&URL='."$url";
  75. $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  76. %>
  77. <A HREF="index.htm"> Return </A>
  78. <A HREF="showsource.asp?<%=$params%>">
  79. <h4><i>view the source</i></h4></A>
  80. </BODY>
  81. </HTML>