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.

47 lines
1.1 KiB

  1. <%
  2. // fnVerifyNumber - Checks a number to make sure its within the proper range and
  3. // type
  4. function fnVerifyNumber( nValue, nLow, nHigh )
  5. {
  6. try
  7. {
  8. var pattern = new RegExp( "^[0-9]{" + String(nLow).length + "," + String(nHigh).length + "}$", "g" );
  9. if ( pattern.test ( nValue ) )
  10. {
  11. if ( (nValue < nLow) || (nValue > nHigh) )
  12. return false;
  13. else
  14. return true;
  15. }
  16. else
  17. {
  18. return false;
  19. }
  20. }
  21. catch ( err )
  22. {
  23. return false;
  24. }
  25. }
  26. //Verify that the guid is properly formatted and within the proper range.
  27. function fnVerifyGUID( gGUID )
  28. {
  29. //The assumptions that we make is that the GUID will consist of letters from a-f (lowercase only!!!)
  30. //and the numbers 0-9 in the exact pattern as the sample guid. If the guid does not match, then it fails
  31. // sample guid: bc94ebaa-195f-4dcc-a4c5-6722a7f942ff
  32. gGUID = String(gGUID).toLowerCase();
  33. var pattern = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/g;
  34. if ( pattern.test( gGUID ) )
  35. return true;
  36. else
  37. return false;
  38. }
  39. %>