Using ODBC database management Serv-u FTP Users and related ASP programming [source code example download]_ application tips

Source: Internet
Author: User
Tags chr md5 md5 encryption odbc mssql rand oracle database
Serv-u is a widely used FTP server-side software, supporting 3x/9x/me/nt/2k and other full Windows series. You can set up multiple FTP servers, restrict the permissions of the logged-in user, login to the main directory and space size, and so on, the function is very complete. It has a very complete security feature, supports SSL FTP transmission, and supports the protection of your data security through SSL encrypted connections across multiple SERV-U and FTP clients.

Serv-u supports user and user group settings based on ODBC databases, which provides a good interface for our serv-u programming, and then describes how to implement them.

First, use ODBC database management Serv-u
Prerequisites: The Enterprise version of Serv-u (version 4.1) is capable of supporting ODBC, and commonly supported databases include access, MySQL, Oracle, and MSSQL.

Serv-u English Official website provides some examples of the database, the site provides downloads, please select:
· Access Example: MS access ODBC Example
· MS SQL Example: MS SQL Server ODBC Example
· MySQL example: MySQL ODBC Example
· SQL file for Oracle CREATE TABLE structure: Oracle database for use with Serv-u

Here's how to use MS SQL as an example
1, install the Serv-u Enterprise version (more than 4.1 version), create a new domain, in step fourth, the domain type select "stored in an ODBC database", as shown in the figure:

2, download the MS SQL Server ODBC Example sample package, get Createservutables.sql (used in MSSQL to create serv-u corresponding table structure) file, and in MSSQL

Row the file, create six tables, respectively:
ftp_users
ftp_userips
ftp_useraccess
ftp_groups
ftp_groupips
ftp_groupaccess
The ftp_users is the most important one for storing the user's table.

3, the establishment of ODBC. The sample procedure is as follows
(1) Add System DSN (System data source), select SQL Server, fill in the data source name and server (local use)

(2) Login verification method According to your MSSQL settings, here in the way of SQL authentication login

(3) Change the database for you to create a good serv-u table database, confirm, complete the ODBC settings. Now that you have a system data source called Serv-u, remember this name and login using the user and password.

4. Configure Serv-u
(1) Close serv-u, obtain the Add-to-ini.txt file from the MS SQL Server ODBC Example sample package, and open the file to complete the following code:
[Domain1]
Odbctables=ftp_users|ftp_groups|ftp_useraccess|ftp_groupaccess|ftp_userips|ftp_groupips
odbccolumns=ftpusername|ftppassword|skey|dirhome|loginmsgfile|accessrule|disabled|sessionencryption| dirhomelock|hidehidden|alwaysallowlogin|changepassword|quotaenable|maxusersloginperip|speedlimitup| Speedlimitdown|maxusersconcurrent|timeoutidle|timeoutsession|ratioup|ratiodown|ratiocredit|quotacurrent| Quotamax|expiration|privilege|ftppasswordtype|ratiotype|groups|notes|indexno

(2) Open the Serv-u installation directory, find the Servudaemon.ini file, the corresponding [Domain1] and its subsequent corresponding settings with the above code to replace.

(3) Reopen your serv-u, find the domain you just created, and you should already be able to see ODBC link settings in ODBC settings, except that the ODBC source name, account number, and password parts are empty, and other table and column names are already set.


(4) Fill out your ODBC source name, account number and password, apply settings, if your settings are no problem, the front of the domain icon will no longer be prohibited appearance, said has been set

(5) Create a random user, and then correspond in your ftp_users table to find out whether there is, if no problem, you have completed the Serv-u ODBC settings.

Second, the implementation of the program ODBC management serv-u users
With the database, the use of programming to achieve management Serv-u users should be a very simple and easy thing, the only difficulty is the encryption of the password.
We know that serv-u three encryption algorithms, by default is a 32-bit MD5 encryption algorithm, which is different from some 16-bit and 64-bit encryption algorithms, so we have to use the program in the 32-bit

MD5 encryption algorithm to achieve encryption of passwords. The following is an example of ASP programming:

Use the following two functions to complete the encryption of the password, 32-bit MD5 encrypted files in this download md5.asp

Function Serupassencode (Strpass)
Dim Char1,char2,seed,prepass,encodepass,finalpass
If IsNull (strpass) Or strpass= "" Then Exit Function
Char1 = Chr (Rand (97,122))
CHAR2 = Chr (Rand (97,122))
Seed = Char1 & Char2
Prepass = Seed & Strpass
Encodepass = Ucase (MD5 (prepass)) ' 32-bit MD5
Finalpass = Seed & Encodepass
Serupassencode = Finalpass
End Function
Function Rand (n,m)
Dim a,b,t
A = N:b = M
If B < a Then t = b:b = A:A = t
Randomize
Rand = Int (rnd* (b-a+1) +a)
End Function
This article is completely original, please respect the author Labor, reprint please indicate the source, thank you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.