Embedded Web development based on goahead

Source: Internet
Author: User

Recently, an embedded web is mainly used to remotely control and manage device parameters. There is very little information about this on the internet, and there are few goahead documents. Now, we will summarize some basic behavior characteristics of goahead for future reference. There are several articles on the Internet.

 

1. goahead features

 

Supports HTML, CGI, goform, embedded ASP (embed Javascript), and some asp statements.

 

In the goform document, it is memory CGI. To put it bluntly, it is a function used to replace CGI programs. However, it is compiled with the goahead server program and needs to be registered with the server through websformdefine.

 

Embedded ASP is a function that can be embedded into a web page. It also needs to be registered like goform, and registered through websaspdefine.

 

The above two features are the most widely used.

 

Websformdefine (T ("formfoo"), "formtest ");

 

Void formtest (webs_t WP, char_t * path, char_t * query );

 

Formtest is a defined function. formfoo is used for calling and is generally used to process forms,

 

For example, <form action =/goform/formfoo method = post>

 

Websaspdefine (T ("aspfoo"), "asptest ");

 

Int asptest (INT Eid, webs_t WP, int argc, char_t ** argv );

 

Asptest is a defined function, which is used for calling on a webpage,

 

For example, <% aspfoo (arg1, arg2...); %> is parsed on the server. you can replace it with different content based on different parameters.

 

Goahead does not fully support ASP. Therefore, some. asp web pages may be faulty and some modifications need to be made to the web pages.

 

2. Goahead user management (this is what I want to talk about most, and there are too few online ).

 

User management depends on a user management file, which is umconfig.txt. Define the user_management_support macro and configure the file.

 

Umconfig.txt contains the user information table, user group information table, and webpage access restriction table.

 

To restrict access to a webpage, You need to define the URI of the webpage in the access restriction table. You can access the service without any restrictions.

 

I have poor expressive ability. I need to post a line of explanation to the file.

 

Umconfig.txt contains the following content:

 

Table = users user information table start

Row = 0 this line cannot be less, the beginning of a user information

Name = admin username admin

Password = uz my password 123456

Group = administrator belongs to the administrator user group

If the value of prot = 1 is 1, this user is protected and cannot be deleted. If the value is 0, this user can be deleted.

If disable = 0 is 0, it indicates enabled. If it is 1, it is disabled.

Row = 1

Name = user

Password = uz

Group = guest

Prot = 0

Disable = 0

Table = groups user group information table

Row = 0 start the information of a user group

Name = Name of the administrator user group

Priv = 4 indicates the access permission of the user group, which can be 0, 1, 2, and 4. am_none, am_read, am_write, and am_admin respectively.

Method = 3 password authentication method, which can be 0, 1, 2, 3. 0. You do not have access to anything. 1. You have access to everything. 2. The password and user name are encrypted and transmitted. 3. The password and user name are encrypted more securely.

Users with the same prot = 1 cannot be deleted.

Disable = 0 Enabled

Row = 1

Name = guest

Priv = 1

Method = 3

Prot = 1

Disable = 0

Table = Access

Row = 0

Name =/home.htm this webpage has authentication requirements

Method = 3

Secure = 0

Group = guest Guest user group can access the/home.htm webpage. The administrator user group cannot access the webpage. Note: Only users in this user group can access this webpage. To change this behavior, you need to change the source code. Goahead first searches for the method attribute of the group associated with the webpage restriction, and the access permission is determined by the method attribute of the group. If the row group = guest is not defined, the access permission is determined based on its method attribute.

Row = 1

Name =/player.htm

Method = 3

Secure = 0

Group = guest

Row = 2

Name =/en/restrict all contents in a directory (including contents in subdirectories. Note that '/' must be followed.

Method = 3

Secure = 0

Group = Administrator

Row = 3

Name =/CN/

Method = 3

Secure = 0

Group = Administrator

 

There may be errors. If you find it, please correct it.

 

To understand the behavior of goahead, you still need to carefully analyze the original code.

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.