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.

98 lines
2.1 KiB

  1. <%
  2. function GetDBConnection ( szConnectionString )
  3. {
  4. try
  5. {
  6. g_DBConn = new ActiveXObject( "ADODB.Connection" );
  7. g_DBConn.CommandTimeout=30;
  8. g_DBConn.ConnectionTimeout = 15;
  9. try
  10. {
  11. g_DBConn.Open( szConnectionString );
  12. }
  13. catch( err )
  14. {
  15. return false;
  16. }
  17. }
  18. catch ( err )
  19. {
  20. return false;
  21. }
  22. return g_DBConn;
  23. }
  24. function fnMakeDBText ( szString )
  25. {
  26. pattern = /'/g;
  27. szString = new String( szString );
  28. if ( String( szString ) != "undefined" )
  29. {
  30. szString = szString.replace( pattern, "''" );
  31. }
  32. return szString;
  33. }
  34. function fnGetCustomerID( PPID )
  35. {
  36. try
  37. {
  38. //Response.Write("PPID: " + PPID + "<BR>" )
  39. if ( PPID == "0" || PPID == "1" )
  40. {
  41. //Response.Write( "PPID no good<BR>" )
  42. if ( !g_objPassportManager )
  43. fnGetPassportObject();
  44. var ppMemberHighID = new String( g_objPassportManager.Profile("MemberIDHigh" ));
  45. var ppMemberLowID = new String ( g_objPassportManager.Profile("MemberIDLow" ) );
  46. var PPID = "0x" + fnHex( ppMemberHighID ) + fnHex( ppMemberLowID );
  47. var ppCustomerEmail = new String( g_objPassportManager.Profile( "PreferredEmail" ));
  48. //Response.Write(" PPMemberID: " + PPID + " <BR>" )
  49. }
  50. var cnCustomerDB = GetDBConnection( Application("L_OCA3_CUSTOMERDB_RO" ), true );
  51. var Query = "OCAV3_GetCustomerID " + Number(PPID) + ",'" + ppCustomerEmail + "'" ;
  52. //Response.Write(" <BR><BR>Query: " + Query + "<BR>" )
  53. var rsCustomerID = cnCustomerDB.Execute( Query );
  54. if ( !rsCustomerID.EOF )
  55. {
  56. //Response.Write("Assigning customer ID: " + rsCustomerID("CustomerID" ) )
  57. var CustomerID = new Number( rsCustomerID("CustomerID" ) )
  58. }
  59. else
  60. {
  61. //Response.Write("RSCustomerId.EOF is true<BR>" )
  62. CustomerID = new Number( 0 );
  63. }
  64. //Removed this cuz we don't want to store the customer ID
  65. //fnWriteCookie( "CID", CustomerID );
  66. cnCustomerDB.Close();
  67. return ( CustomerID )
  68. }
  69. catch( err )
  70. {
  71. ;//will fall through to the end
  72. }
  73. return ( 0 )
  74. }
  75. %>