uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
Unique Identifier Subroutine

Knowledge Base Lobby : uTest Support Conference : CGI Configuration Questions
Dec-11-17 03:54 PM EST
Original Message
Unique Identifier Subroutine
Author Dave Parker on 07-14-2002 at 13:12 (EST)
Howdy another quick question, is there a way to modify the cgi script to generate a shorter unique identification number? I noticed there is a random number generation routine in the script, I just need it to generate a shorter number.

Thanks for any help you can provide.

Dave Parker
E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  RE: Unique Identifier Subroutine Bill Weiner, 2002-07-15 05:34:43 (1)

Messages In This Discussion
         1. RE: Unique Identifier Subroutine
        Author Bill Weiner on 07-15-2002 at 05:34 (EST)
The unique identification number is created in the "process_answers" subroutine of the utest.pl script... so you can modify that subroutine to shorten the number. By default, the id is created by appending 7 digit random number onto the current date, via following lines:

srand(time&pip;$$);
$random_number = int(rand(1000000));
$unique_identifier = "$formatted_date-$random_number";

You can make the random number smaller by just making the rand() number smaller, such as 4 digits instead of 7:

srand(time&pip;$$);
$random_number = int(rand(1000));
$unique_identifier = "$formatted_date-$random_number";

Or you could get rid of the date, such as:

srand(time&pip;$$);
$random_number = int(rand(1000));
$unique_identifier = "$random_number";

Note when making either of these changes, be sure to:

STEP 1: Make a backup copy of your utest.pl script... just in case.

STEP 2: Use any text editor... such as WordPad... to edit the script.

STEP 3: Be sure to remember to transfer the script to/from your server in ASCII or TEXT transfer mode (not binary transfer mode).
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.