⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p371_init.htm

📁 javascript source code part2
💻 HTM
字号:
<HTML>
<HEAD>
<TITLE>
Voting Initialization
</TITLE>
</HEAD>
<BODY>
You shouldn't see this page.
</BODY>

<SERVER>
// create a pool of 5 connections
//anonymous database access with write rights, probably not a good idea in practice ;)
project.appPool = new DbPool("ODBC","voting","","","",5,true);

//LDAP setup

//set to your LDAP host
project.host        = "airwolf";
//set to your LDAP port
project.port        = 389;
//set to your Directory Base
//change to match your server's
project.searchBase  = "o=airius.com"

//the Distinguished Name you are going to use
//project.mgr_dn      = "";
//Password for the Distinguished Name
//maybe blank for mgr_dn & mgr_pw if directory allows anonymous searches
//project.mgr_pw      = "";

// Grab an LDAP object 
var ldap           = new LDAP(project.host,parseInt(project.port),project.searchBase,parseInt(0), 
                           project.mgr_dn,project.mgr_pw); 

   //LDAP setup - note the settings below reflect the default NDS installation

   //set to your LDAP host
   project.host = "airwolf";

   //set to your LDAP port
   project.port = 389;

   //set to your Directory Base
   //change to match your server's
   project.searchBase = "o=airius.com"

//the Distinguished Name you are going to use
//project.mgr_dn = "";
//Password for the Distinguished Name
//maybe blank for mgr_dn & mgr_pw if directory allows anonymous searches
//project.mgr_pw = "";

// Grab an LDAP object 
var ldap           = new LDAP(project.host,parseInt(project.port),project.searchBase,parseInt(0), 
                           project.mgr_dn,project.mgr_pw); 

debug("set ldap"+ldap);
//authenticate if necessary
//ldap.authenticate(project.mgr_dn,project.mgr_pw);
//set your scope
ldap.setSearchScope(parseInt(ldap.SCOPE_SUB));
                         

//   The redirect in the following code is irrelevant when this initial page is 
//   called during app or server startup.  In order to make better use of the code, 
//   I've included it so that I can reuese the code should "project.ldap" need 
//   to be reinitialized.  
//   Thus, In the start page (login.htm) I've included the following lines:
    
 //     if (project.ldap == void(0)){
 //       redirect('init.htm');
//      }
    
//   This checks for the existance of 'project.ldap' and redirects back to this page
//   if needed. 


if (ldap == null){
  /* connection could not be made */
  write("Failed to connect to LDAP server. See error log or Java Console<br>");
}
else{
  /* store the connection in the project object. */
  project.ldap = ldap;
  redirect("login.htm");        
}  
</SERVER>
</HTML>>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -