home *** CD-ROM | disk | FTP | other *** search
/ Teach Yourself CGI Programming with Perl in a Week / CGIPROGRAMMINGPERL.iso / booksrc / 07cgil02.cgi < prev    next >
Encoding:
Text File  |  1995-12-08  |  860 b   |  31 lines

  1. #! /usr/local/bin/perl
  2.  
  3. print "Content-Type: text/html \n\n";
  4.  
  5. print <<'EOF';
  6. <HTM>
  7. <HEAD><TITLE> GENERATING A UNIQUE CUSTOMER ID </TITLE>
  8. </HEAD>
  9. <BODY>
  10.  
  11. <h3>  The following unique customer id is made up of three parts: <h3>
  12. <ul>
  13. <li>The first part is the process id.  The process id is unique for each 
  14. process, while that process is running.
  15. <li>The second part, separated by the dash character (-), is the IP address of
  16. the Web Customer.
  17. <li>The last part, also separated by the dash character (-), is the number of
  18. non-leap seconds since January 1, 1970.
  19. </ul>
  20. <h3>  This should produce a unique value that is difficult to predict, and 
  21. therfore hard to forge. </h3>
  22. <hr noshade>
  23. EOF
  24. $unique_customer_id = $$ . "-" . $ENV{'REMOTE_ADDR'} . "-" . time();
  25. print " $unique_customer_id <BR>";
  26. print <<'EOF' ;
  27. </BODY>
  28. </HTML>
  29. EOF
  30.  
  31.