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.

92 lines
2.5 KiB

  1. #!/usr/local/bin/perl
  2. use CGI qw(:standard :html3);
  3. # Some constants to use in our form.
  4. @colors=qw/aqua black blue fuschia gray green lime maroon navy olive
  5. purple red silver teal white yellow/;
  6. @sizes=("<default>",1..7);
  7. # recover the "preferences" cookie.
  8. %preferences = cookie('preferences');
  9. # If the user wants to change the background color or her
  10. # name, they will appear among our CGI parameters.
  11. foreach ('text','background','name','size') {
  12. $preferences{$_} = param($_) || $preferences{$_};
  13. }
  14. # Set some defaults
  15. $preferences{'background'} = $preferences{'background'} || 'silver';
  16. $preferences{'text'} = $preferences{'text'} || 'black';
  17. # Refresh the cookie so that it doesn't expire. This also
  18. # makes any changes the user made permanent.
  19. $the_cookie = cookie(-name=>'preferences',
  20. -value=>\%preferences,
  21. -expires=>'+30d');
  22. print header(-cookie=>$the_cookie);
  23. # Adjust the title to incorporate the user's name, if provided.
  24. $title = $preferences{'name'} ?
  25. "Welcome back, $preferences{name}!" : "Customizable Page";
  26. # Create the HTML page. We use several of Netscape's
  27. # extended tags to control the background color and the
  28. # font size. It's safe to use Netscape features here because
  29. # cookies don't work anywhere else anyway.
  30. print start_html(-title=>$title,
  31. -bgcolor=>$preferences{'background'},
  32. -text=>$preferences{'text'}
  33. );
  34. print basefont({SIZE=>$preferences{size}}) if $preferences{'size'} > 0;
  35. print h1($title),<<END;
  36. You can change the appearance of this page by submitting
  37. the fill-out form below. If you return to this page any time
  38. within 30 days, your preferences will be restored.
  39. END
  40. ;
  41. # Create the form
  42. print hr(),
  43. start_form,
  44. "Your first name: ",
  45. textfield(-name=>'name',
  46. -default=>$preferences{'name'},
  47. -size=>30),br,
  48. table(
  49. TR(
  50. td("Preferred"),
  51. td("Page color:"),
  52. td(popup_menu(-name=>'background',
  53. -values=>\@colors,
  54. -default=>$preferences{'background'})
  55. ),
  56. ),
  57. TR(
  58. td(''),
  59. td("Text color:"),
  60. td(popup_menu(-name=>'text',
  61. -values=>\@colors,
  62. -default=>$preferences{'text'})
  63. )
  64. ),
  65. TR(
  66. td(''),
  67. td("Font size:"),
  68. td(popup_menu(-name=>'size',
  69. -values=>\@sizes,
  70. -default=>$preferences{'size'})
  71. )
  72. )
  73. ),
  74. submit(-label=>'Set preferences'),
  75. hr;
  76. print a({HREF=>"/"},'Go to the home page');
  77. print end_html;