`

密钥管理页面的实现

 
阅读更多









实现的功能:可以实现公钥的管理
功能1:可以有保存开启公钥
功能2: 可以单个删除、批量删除
功能3:可以添加公钥



#include "../lib/slas_common.h"
#include "../lib/log_defines.h"
#include "../lib/slas_paths.h"
#include "../lib/slas_defines.h"
#include "../lib/slas_structs.h"
#include "../lib/slas.h"
#include "../lib/utils.h"
#include "../lib/cgi.h"
#include "../lib/libpq-fe.h"
#include "../libso/sessplan.h"
#include "../libso/session.h"
#include "../libso/logs.h"


//#define PULIC_KTY "/storage/etc/ssh_public/"
#define PULIC_KTY "/etc/ssh_public/"

int CheckXm(char *);
int CheckRecord(char *);
int CheckB64(char *);
void changejh(char *);

typedef struct _ManagementList{
	char key[1024];
	char name[256];
	struct _ManagementList *next;	
}ManagementList;

/*
//获取公钥列表
int ManListGet(char *user, ManagementList* head, int public_key){
	FILE *fp = NULL, *fp_name = NULL;
	char temp_key[1024];
	char temp_name[512];	
	char path_key[1024];
	char path_key1[512];
	char path_name[1024];
	char cmd[512];
	int count = 0;
	
	sprintf(path_key, "%s%s_authorized_keys", PULIC_KTY, user);	
	sprintf(path_key1, "%s%s_authorized_keys.un", PULIC_KTY, user);	
	sprintf(path_name, "%s%s_authorized_name", PULIC_KTY, user);
	
	if(public_key){//开启公钥
		if (!access(path_key, F_OK)){		
			while(fgets(temp_key, 1024, fp)){
			
				ManagementList *newnode = (ManagementList *)malloc(sizeof(ManagementList));			
				strcpy(newnode->key, path_key);
				sprintf(newnode->name, "公钥-%d\n", count);
				
				if (!(fp_name = fopen(path_name, "a+"))) 				//写入对应的公钥名称
				{
					return -1;
				}
				fputs(newnode->name, fp_name);
				
				newnode->next = NULL;
				if(head->next == NULL){
					head->next = newnode;
					node = head->next;
				}else {
					node->next = newnode;
					node = node->next;
				}
								
				count++;
			}

		}
	}else{
		if (NULL != access(path_key, F_OK)){
			return -1
		}
			memset(cmd, 0, sizeof(cmd));
			sprintf(cmd, "mv -f %s %s", path_key, path_key1);//读取没有开启的公钥文件
			system(cmd);
			chmod(path_key1, 0600);			
			while(fgets(temp_key, 1024, fp)){
				ManagementList *newnode = (ManagementList *)malloc(sizeof(ManagementList));			
				strcpy(newnode->key, path_key);
				sprintf(newnode->name, "公钥-%d\n", count);
				
				if (NULL == (fp_name = fopen(path_name, "a+"))) return -5; //写入对应的公钥名称
					fputs(newnode->name, fp_name);
				
				newnode->next = NULL;
				if(head->next == NULL){
					head->next = newnode;
					node = head->next;
				}else {
					node->next = newnode;
					node = node->next;
				}
								
				count++;
			}		
	}
	
	fclose(fp);
	return count;
}
*/

int ManListAdd(char *user, char *description,  char *keyname, int public_key) {
	FILE *fp = NULL, *fp1 = NULL;
//	char cmd[256];
	char path[1024];
	char path1[1024];
	char path2[1024];	
	int sgin_key = 0, sgin_key1 = 0;
	
	memset(path, 0, sizeof(path));
	memset(path1, 0, sizeof(path1));
	memset(path2, 0, sizeof(path2));		
	sprintf(path, "%s%s_authorized_keys", PULIC_KTY, user);	
	sprintf(path1, "%s%s_authorized_keys.un", PULIC_KTY, user);	
	sprintf(path2, "%s%s_authorized_name", PULIC_KTY, user);		

	
	if (access(path, F_OK)){
		sgin_key = 1;
	}
	if (access(path1, F_OK)){
		sgin_key1 = 1;
	}	

	if(sgin_key == 1 && sgin_key1 == 1){
		if(public_key==1){
			if (NULL == (fp = fopen(path, "a+"))){	
				printf("open file failed %s:%s\n",path,strerror(errno));
				return -1;
			}
		}else{
			if (NULL == (fp = fopen(path1, "a+"))){	
				printf("open file failed %s:%s\n",path,strerror(errno));
				return -1;
			}		
		}
	}
	else if(!sgin_key){
		if (NULL == (fp = fopen(path, "a+"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -1;
		}
		fprintf(fp, "%s\n", description);
	}
	else {
		if (NULL == (fp = fopen(path1, "a+"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -1;
		}
		fprintf(fp, "%s\n", description);
	}
    
	if (NULL == (fp1 = fopen(path2, "a+"))){	
		printf("open file failed %s:%s\n",path2,strerror(errno));
		return -1;
	}
	fprintf(fp1, "%s\n", keyname);
	

	fclose(fp);
	fclose(fp1);
//	memset(cmd, 0, sizeof(cmd));
//	sprintf(cmd, "mv -f %s.swap %s", path, path1);
	//system(cmd);
	chmod(path, 0600);
	chmod(path1, 0600);	
	return 0;
}





int Pub_keyGet(char *user){
	FILE *fp = NULL;
	char temp[10];
	char path[1024];
	sprintf(path, "%s%s_key", PULIC_KTY, user);	
	if (access(path, F_OK)) return 0;
	if (NULL == (fp = fopen(path, "r"))) return -1;


	fgets(temp, 9, fp);
	if(!strncmp(temp, "false",5)){
		return 0;
	}else{
		return 1;
	}
}

int Pub_keySet(int public_key, char *user) {
	FILE *fp = NULL;
	char path[1024];
	memset(path, 0, sizeof(path));

	sprintf(path, "%s%s_key", PULIC_KTY, user);	
	if (NULL == (fp = fopen(path, "w+"))){	
		printf("open file failed %s:%s\n",path,strerror(errno));
		return -1;
	}
	if(public_key == 0)
		fprintf(fp, "false\n");
	else
		fprintf(fp, "true\n");

	fclose(fp);
	chmod(path, 0666);
	return 0;
}


/*
int Delstr(int pubilc_key, char *user, char *delstr){
	FILE *fp = NULL, *fp2 = NULL, *fp_name = NULL, *fp_name1 = NULL;
	char path[1024], path1[1024], path_name[1024], buf[1024], buftemp[1024], path_name1[1024];
	int i = 0,  sgin = 1, sgin_key = 0, sgin_key1 = 0;
	memset(path, 0, sizeof(path));
	memset(path1, 0, sizeof(path1));
	memset(path_name, 0, sizeof(path_name));	


	if (access(path, F_OK)){
		sgin_key = 1;
	}
	if (access(path1, F_OK)){
		sgin_key1 = 1;
	}

	if(pubilc_key){
		sprintf(path, "%s%s_authorized_keys", PULIC_KTY, user);	
		if (NULL == (fp = fopen(path, "r"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -1;
		}
		
		
		while(fgets(buf, 1024, fp)){
			strcpy(buftemp,buf);
			if(strncmp(buf,delstr,strlen(buf)-1))  //起始key不符合
			{
				fputs(buftemp, fp2);				//写入新文件
				i++;
				continue;	
			}else{
				sgin = i;
			}			
		}

		
		sprintf(path, "%s%s_authorized_name", PULIC_KTY, user);			
		if (NULL == (fp_name = fopen(path_name, "w+"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -1;
		}		
		while(fgets(buf, 1024, fp_name)){
			strcpy(buftemp,buf);
			if(sgin!= i)  //起始key不符合
			{
				fputs(buftemp, fp2);				//写入新文件
				continue;	
			}			
		}
		
		fclose(fp);
		fclose(fp_name);		
		fclose(fp2);
		if(access(path1,F_OK) == 0) {
				rename(path1,path);
		}
		
	}else{
		sprintf(path, "%s%s_authorized_keys", PULIC_KTY, user);	
		if (NULL == (fp = fopen(path, "w+"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -2;
		}	
		
		sprintf(path1, "%s%s_authorized_keys.un", PULIC_KTY, user);	
		if (NULL == (fp2 = fopen(path1, "r"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -2;
		}		
		
		while(fgets(buf, 1024, fp2)){
			strcpy(buftemp,buf);
			if(strncmp(buf,delstr,strlen(buf)-1))   //起始key不符合
			{
				fputs(buftemp, fp);	//写入新文件
				continue;	
			}else{
				sgin = i++;
				trace("sgin=%d\n\n", sgin);
			}	
			i++;			
		}

		
		sprintf(path_name1, "%s%s_authorized_name.un", PULIC_KTY, user);	
		if (NULL == (fp_name1 = fopen(path_name1, "w+"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -2;
		}	
		
		sprintf(path_name, "%s%s_authorized_name", PULIC_KTY, user);		
		if (NULL == (fp_name = fopen(path_name, "r"))){	
			printf("open file failed %s:%s\n",path,strerror(errno));
			return -3;
		}			
	
		i=0;	
		while(fgets(buf, 1024, fp_name)){
			strcpy(buftemp,buf);

			if(sgin != i)  //起始key不符合
			{
				fputs(buftemp, fp_name1);				//写入新文件
				continue;	
			}
			i++;
		}	

		
		fclose(fp);
		fclose(fp2);		
		fclose(fp_name);
		fclose(fp_name1);
		if(access(path1,F_OK) == 0) {
			rename(path,path1);
		}
		if(access(path1,F_OK) == 0) {
			rename(path_name1,path_name);
		}			
	}
	
	return 0;
}

*/



int Delstr(int pubilc_key, char *user, char *delstr){
	FILE  *fp_name = NULL, *new_fp_name = NULL, *fp_key = NULL, *new_fp_key =NULL;
	char path_key[1024], new_path_key[1024], path_name[1024], new_path_name[1024], buf[1024], *str1 = NULL, *tok1 = NULL;
	int i = 0, ii = 0, iii=0, strvalue[1024], sgin = 0;
	memset(path_key, 0, sizeof(path_key));
	memset(new_path_key, 0, sizeof(new_path_key));
	memset(path_name, 0, sizeof(path_name));
	memset(new_path_name, 0, sizeof(new_path_name));	
	memset(strvalue, 0, sizeof(strvalue));	
	
	for(str1 = strtok_r(delstr, ",", &tok1); NULL != str1; str1 = strtok_r(NULL, ",", &tok1)){
		strvalue[ii] = atoi(str1);
		ii++;
	}
	
	--ii;

	if(pubilc_key){
		sprintf(path_key, "%s%s_authorized_keys", PULIC_KTY, user);	
		if (NULL == (fp_key = fopen(path_key, "r"))){	
			printf("open file failed %s:%s\n",path_key,strerror(errno));
			return -1;
		}

		sprintf(new_path_key, "%s%s_authorized_keys.new", PULIC_KTY, user);	
		if (NULL == (new_fp_key = fopen(new_path_key, "w+"))){	
			printf("open file failed %s:%s\n",new_path_key,strerror(errno));
			return -1;
		}
		
		i = 0;
		for(i=0; fgets(buf, 1024, fp_key); i++){
			for(iii=0; iii<= ii; iii++){
				if(strvalue[iii] == i){
					sgin = 1;				
				}
			}
		
			if(	sgin != 1)   //起始key不符合
			{
				fputs(buf, new_fp_key);	//写入新文件
				continue;	
			}
			sgin = 0;
		}
		
		sprintf(path_name, "%s%s_authorized_name", PULIC_KTY, user);			
		if (NULL == (fp_name = fopen(path_name, "r"))){	
			printf("open file failed %s:%s\n",path_name,strerror(errno));
			return -1;
		}	

		sprintf(new_path_name, "%s%s_authorized_name.new", PULIC_KTY, user);			
		if (NULL == (new_fp_name = fopen(new_path_name, "w+"))){	
			printf("open file failed %s:%s\n",new_path_name,strerror(errno));
			return -1;
		}	
		
		i = 0;
		for(i=0;fgets(buf, 1024, fp_name); i++){
			for(iii=0; iii<= ii; iii++){
				if(strvalue[iii] == i){
					sgin= 1;
				}
			}
			if(	sgin != 1)   //起始key不符合
			{
				fputs(buf, new_fp_name);	//写入新文件
				continue;	
			}
			sgin = 0;
		}	
		
		fclose(fp_key);
		fclose(new_fp_key);
		fclose(fp_name);
		fclose(new_fp_name);
		
		rename(new_path_key,path_key);
		rename(new_path_name,path_name);
		
	}else{
		sprintf(new_path_key, "%s%s_authorized_keys.un.new", PULIC_KTY, user);	
		if (NULL == (new_fp_key = fopen(new_path_key, "w+"))){	
			printf("open file failed %s:%s\n",new_path_key,strerror(errno));
			return -2;
		}	
		
		sprintf(path_key, "%s%s_authorized_keys.un", PULIC_KTY, user);	
		if (NULL == (fp_key = fopen(path_key, "r"))){	
			printf("open file failed %s:%s\n",path_key,strerror(errno));
			return -3;
		}		
		
		for(i=0; fgets(buf, 1024, fp_key); i++){
			for(iii=0; iii<= ii; iii++){
				if(strvalue[iii] == i){
					sgin = 1;				
				}
			}
		
			if(	sgin != 1)   //起始key不符合
			{
				fputs(buf, new_fp_key);	//写入新文件
				continue;	
			}
			sgin = 0;
		}

		
		sprintf(new_path_name, "%s%s_authorized_name.un", PULIC_KTY, user);	
		if (NULL == (new_fp_name = fopen(new_path_name, "w+"))){	
			printf("open file failed %s:%s\n",new_path_name,strerror(errno));
			return -2;
		}	
		
		sprintf(path_name, "%s%s_authorized_name", PULIC_KTY, user);		
		if (NULL == (fp_name = fopen(path_name, "r"))){	
			printf("open file failed %s:%s\n", path_name,strerror(errno));
			return -3;
		}			
	
	
		for(i=0;fgets(buf, 1024, fp_name); i++){
			for(iii=0; iii<= ii; iii++){
				if(strvalue[iii] == i){
					sgin= 1;
				}
			}
			if(	sgin != 1)   //起始key不符合
			{
				fputs(buf, new_fp_name);	//写入新文件
				continue;	
			}
			sgin = 0;
		}	

		
		fclose(fp_key);
		fclose(new_fp_key);		
		fclose(fp_name);
		fclose(new_fp_name);

		rename(new_path_key,path_key);
		rename(new_path_name,path_name);


	/*	memset(cmd, 0, sizeof(cmd));
		sprintf(cmd, "mv -f %s %s", new_path_key, path_key);
		system(cmd);
		chmod(path_key, 0600);

		memset(cmd, 0, sizeof(cmd));
		sprintf(cmd, "mv -f %s %s", new_path_name, path_name);
		system(cmd);
		chmod(path_name, 0600);*/
	
		
	}
	
	return 0;
}







void showhtml(u_int64 session, char *user){
	int count = 0, i = 0, public_key = 0, sgin_key = 0, sgin_key1 = 0; 
	ManagementList *head = NULL;
	ManagementList *node = NULL;
	head = (ManagementList *)malloc(sizeof(ManagementList));
	head->next = NULL;
	memset(head,0,sizeof(ManagementList));

	FILE *fp = NULL, *fp1 = NULL, *fp_name = NULL;	
	char path_key[1024];
	char path_key1[2048];
	char path_name[1024];
	char buf[2048];
	char cmd[512];
	
	sprintf(path_key, "%s%s_authorized_keys", PULIC_KTY, user);	
	sprintf(path_key1, "%s%s_authorized_keys.un", PULIC_KTY, user);	
	sprintf(path_name, "%s%s_authorized_name", PULIC_KTY, user);

	if (access(path_key, F_OK)){
		sgin_key = 1;
	}
	if (access(path_key1, F_OK)){
		sgin_key1 = 1;
	}

	
	public_key = Pub_keyGet(user);
	
	if(public_key == -1){
		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥开启文件打开失败',function(){history.back();});</script></body></html>");		
		return; 
	}
	
	if(public_key==1){//开启公钥1
		if (sgin_key==1 && sgin_key1 == 1){
			if(!(fp = fopen(path_key, "w+"))){
				printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
				return; 
			}
			fclose(fp);
		}else{
			if(!sgin_key1){
				memset(cmd, 0, sizeof(cmd));
				sprintf(cmd, "mv -f %s %s", path_key1, path_key);//读取没有开启的公钥文件	
				system(cmd);
				chmod(path_key, 0666);	
				
				if(!(fp = fopen(path_key, "r"))){
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return; 
				}
				if (!(fp_name = fopen(path_name, "r"))) 				//写入对应的公钥名称
				{
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return;
				}					
		
				while(fgets(path_key, 1024, fp) && fgets(buf, 1024, fp_name)){
					ManagementList *newnode = (ManagementList *)malloc(sizeof(ManagementList));			
					strncpy(newnode->key,  path_key, strlen(path_key)-1);


					strncpy(newnode->name,  buf, strlen(buf)-1);
					
				
					newnode->next = NULL;
					if(head->next == NULL){
						head->next = newnode;
						node = head->next;
					}else {
						node->next = newnode;
						node = node->next;
					}		
					count++;
				}
						
				fclose(fp);			
				fclose(fp_name);
			}else{
				if (access(path_key, F_OK)){
					if (!(fp = fopen(path_key, "w+"))) 				//写入对应的公钥名称
					{
						printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
						return;
					}
				}else{			
					if(!(fp = fopen(path_key, "r"))){
						printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
						return; 
					}					
				}
				
				
				if (access(path_name, F_OK)){
					if (!(fp_name = fopen(path_name, "w+"))) 				//写入对应的公钥名称
					{
						printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
						return;
					}
				}else{			
					if (!(fp_name = fopen(path_name, "r"))) 				//写入对应的公钥名称
					{
						printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
						return;
					}					
				}
									
						
				while(fgets(path_key, 1024, fp) && fgets(buf, 1024, fp_name)){
					ManagementList *newnode = (ManagementList *)malloc(sizeof(ManagementList));			
					strncpy(newnode->key,  path_key, strlen(path_key)-1);


					strncpy(newnode->name,  buf, strlen(buf)-1);
					
				
					newnode->next = NULL;
					if(head->next == NULL){
						head->next = newnode;
						node = head->next;
					}else {
						node->next = newnode;
						node = node->next;
					}		
					count++;
				}
			fclose(fp);			
			fclose(fp_name);	
			}
		}	

	}else{//读取没有开启的公钥文件
		if (sgin_key==1 && sgin_key1 == 1){
			if(!(fp1 = fopen(path_key1, "w+"))){
				printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
				return; 
			}
			fclose(fp1);				
		}else{
			if(!sgin_key){
				memset(cmd, 0, sizeof(cmd));
				sprintf(cmd, "mv -f %s %s", path_key, path_key1);//读取没有开启的公钥文件	
				system(cmd);
				chmod(path_key1, 0666);			
				if(!(fp1 = fopen(path_key1, "r"))){
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return; 
				}		
			}else{
				if(!(fp1 = fopen(path_key1, "r"))){
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('公钥备注列表打开失败',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return; 
				}			
			}

			if (access(path_name, F_OK)){
				if (!(fp_name = fopen(path_name, "w+"))) 				//写入对应的公钥名称
				{
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return;
				}
			}else{			
				if (!(fp_name = fopen(path_name, "r"))) 				//写入对应的公钥名称
				{
					printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误1',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);		
					return;
				}					
			}
			
			while(fgets(path_key, 1024, fp1) && fgets(buf, 1024, fp_name)){
				ManagementList *newnode = (ManagementList *)malloc(sizeof(ManagementList));			
				strncpy(newnode->key,  path_key, strlen(path_key)-1);


				strncpy(newnode->name,  buf, strlen(buf)-1);
				
			
				newnode->next = NULL;
				if(head->next == NULL){
					head->next = newnode;
					node = head->next;
				}else {
					node->next = newnode;
					node = node->next;
				}		
				count++;
			}
			
			fclose(fp1);			
			fclose(fp_name);
		}	
	}

	
	
	node = head->next;


	printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
	printf("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
	printf("<head>\n");
	printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\n");
	printf("<link href=\"/bh/style/middle_style.css\" rel=\"stylesheet\" type=\"text/css\"/>\n");
	printf("<script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/jquery.wresize.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/contentboxdivresiez.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/tab_style.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/table_litmenu_100.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/bindpage.js\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/common.js\" language=\"javascript\" type=\"text/javascript\"></script>\n");
	printf("<script src=\"/bh/pjs/bh_user.js\" language=\"javascript\" type=\"text/javascript\"></script>");
	printf("<script type=\"text/javascript\"> \n");
	printf("$(function(){\n");
	printf("	tabEvent(\"#tabledivbox\");\n");
	printf("	litmenu(\"#tabledivbox\");\n");
	printf("	wwinsize(0,180);//传入合适高度\n");
	printf("	\n");
	printf("	//阻止冒泡\n");
	printf("	 $(\"#content tbody tr td:first input:checkbox\").click(function(event){\n");
	printf("		event.stopPropagation();\n");
	printf("	});\n");
	if(public_key == 1){
		printf("	$(\"#public_key\").prop(\"checked\",true); \n");	
	}else
		printf("	$(\"#public_key\").prop(\"checked\",false); \n");	
	printf("})\n");
	printf("</script>\n");
	printf("</head>\n");
	printf("<body>\n");
	printf("<form action=\"\" method=\"post\" name=\"frm\">\n");
	printf("<input type=\"hidden\" name=\"tasktype\" id=\"tasktype\" value=\"\">\n");
	printf("<input type=\"hidden\" name=\"session\" id=\"session\" value=\"%llu\">\n",session);
	printf("<input type=\"hidden\" name=\"delstr\" id=\"delstr\" value=\"\">\n");

	printf("<div class=\"head-box\" style=\"width:auto;border-left:1px solid #d8d8d8;border-right:1px solid #d8d8d8\">\n");
	printf("	<h3 class=\"now\">ssh public key</h3>\n");
	printf("	<div class=\"guolvbox divrightbox\">\n");
	printf("		<span _style=\"margin-top:2px\"><label><input type=\"checkbox\" name=\"public_key\" id=\"public_key\" value=\"1\">是否开启公钥</label></span>\n");
	printf("	</div>");
	printf("</div>\n");

	printf("<div id=\"tabledivbox\" >\n");
	printf("<!--此div为小菜单--><div id=\"poslitmenubox\"><div id=\"poslitmenu\"></div></div>\n");
	printf("<!--表头-->\n");
	printf("<div style=\"border:1px solid #ccc;border-top:none;width:100%%;position:absolute;height:29px;z-index:0;margin-left:-1px;\">\n");
	printf("</div>\n");
	printf("<div class=\"faux-head\">\n");
	printf("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%%;\" id=\"tab-head\">\n");
	printf("<thead>\n");
	printf("<tr>\n");
	printf("<th style=\"width:50px;\"><input type=\"checkbox\" name=\"d_all\" id=\"d_all\"  value=\"CheckAll\" onClick=\"checkall(this,%d,'d');\"/></th>\n", count);
	printf("<th style=\"width:320px\">公钥名称</th>\n");
	printf("<th style=\"background-image:none\">公钥内容</th>\n");
	printf("<th style=\"width:120px\" class=\"mangerlei\">管理</th>\n");
	printf("</tr>\n");
	printf("</thead>\n");
	printf("</table>\n");
	printf("</div>\n");
	printf("<div style=\"height:29px;width:100%%;background:#f2f2f2;\"></div>\n");
	printf("<!--此div包含作用为出滚动条-->\n");
	printf("<div class=\"tableboabox\">\n");
	printf("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%%;\" id=\"content\">\n");
	printf("<!--此处为表格实际宽度,如果表格不需要出现小菜单则把表格宽度设为100%%-->\n");
	printf("<tbody>\n");

	if(count<0){
//		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误%d',function(){top.location.href='/';});</script></body></html>",count);
		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('获取公钥备注列表错误%d',function(){history.back();});</script></body></html>",count);
		return;
	}		
	while (node){
		printf(" <tr>\n");
		printf("		<td style=\"width:50px\"><input type=\"checkbox\" name=\"d_%d\" id=\"d_%d\" onclick=\"checkqs(this,%d);\" value=\"%d\"/></td>\n",i,i,i,i);
		printf("        <td style=\"width:320px\">%s</td>\n", node->name);
		printf("        <td><span class=\"kill\" style=\"width:300px\">%s</span></td>\n", node->key);
		printf("		<td class=\"mangerlei\" style=\"width:120px\"><a href=\"#@\" onclick=\"key_del('%d');\">删除</a></td>\n", i);
		printf(" </tr>\n");
		i++;
		node = node->next;	
	}


	printf("</tbody>\n");
	printf("</table>\n");
	printf("</div>\n");
	printf("</div>\n");


	printf("	<div class=\"diag\" id=\"Dialog01\">\n");
	printf("		<div class=\"diag1\">\n");
	printf("			<div class=\"head-box-main diagh\">\n");
	printf("				<h3 class=\"now diagh3\">公钥列表</h3>\n");
	printf("			 <a class=\"dialog-close\" onclick=\"closeDialog('#Dialog01')\" href=\"javascript:void(0)\"></a>\n");
	printf("		   </div>\n");
	printf("			<!-- head-box-main end  -->\n");
	printf("			<div class=\"diag_main\">\n");
	printf("				<div class=\"diag_main_c\">\n");
	printf("					<ul id=\"TypeList\" class=\"TypeList\">\n");
	printf("						<li>\n");
	printf("							<span style=\"float:right;\"></span>公钥名称:<input name=\"keyname\" id=\"keyname\" type=\"text\" maxlength=\"32\" class=\"textbox\" value=\"\" style=\"margin-right:20px;\" > \n");
	printf("						</li>\n");
	printf("						<li>\n");
	printf("							<span style=\"float:right;\"></span>公钥内容:\n");
	printf("						</li>\n");
	printf("						<li>\n");
	printf("							<td><textarea name=\"description\" id=\"description\" cols=\"60\" rows=\"5\" onpropertychange=\"if(document.frm.description.value.length>1023) {value=value.substr(0,1023);alert('输入字符已达到最大值!');}\"></textarea></td> \n");
	printf("						</li>\n");
	printf("					</ul>\n");
	printf("				   <!-- TypeList end  -->\n");
	printf("				   <div class=\"diag_btn\">\n");
	printf("						<a class=\"btn_four_grly\" id=\"save\" onclick=\"Remark_Save();\" href=\"javascript:void(0);\">确定</a>\n");
	printf("						<a class=\"btn_four_grly\"  id=\"cancel\" onclick=\"Cancel();\" href=\"javascript:void(0);\">返回</a>\n");
	printf("				   </div>\n");
	printf("				   <!-- diag_btn  -->\n");
	printf("				</div>\n");
	printf("				<!-- diag_main_c end -->\n");
	printf("			</div>\n");
	printf("			<!-- diag_main end  -->\n");
	printf("			<div class=\"diag_footer\"></div>\n");
	printf("	\n");		
	printf("		</div>\n");
	printf("		 <!-- diag1 end  -->\n");
	printf("	</div>\n");
	
	
	printf("<div class=\"fenyelistbox\">\n");
	printf("<div class=\"ctrl-btn\" style=\"padding:0;margin-left:-10px;_margin-left:-5px\">");
	printf("<a class=\"btn_four_blue\" href=\"#@\" onclick=\"getkeyplanTotalStr('%d');\">批量删除</a>", count);
	printf(" <a href=\"#@\" class=\"btn_four_grly\" id=\"add\" onclick=\"__getDialog('#Dialog01');\">添加</a></div>\n");
	printf(" <a href=\"#@\" class=\"btn_four_grly\" id=\"baocun\" onclick=\"Save();\">保存</a></div>\n");
	printf("	</div>\n");
	printf("</form>\n");
	printf("</body>\n");
	printf("<script>\n");
	printf("function gettype() {\n");
	printf("	var reg_ip = /^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$/;\n");
	printf("	var reg_ip = /^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$/;\n");
	printf("	if(!reg_ip.test(document.frm.ip.value)) document.frm.type.value = 1;\n");
	printf("	else document.frm.type.value = 0;\n");
	printf("}\n");
	
	//保存
	printf("function Save(){\n ");
	printf("	document.frm.tasktype.value = 2;\n");	
	printf("	document.frm.submit();	\n");	
	printf("}\n");
	
	
 	printf("function __getDialog(obj){\n");
  
	printf("	var ww = $(window).width(), wh = $(window).height();\n");
	printf("	var ow = $(obj).width(), oh = $(obj).height();\n");
	printf("	var p = document.documentElement.scrollTop || document.body.scrollTop;\n");

	printf("	$(obj).css({\n");
	printf("		\"top\":(wh - oh)/2+p > 0 ? (wh - oh)/2+p : 0,\n");
	printf("		\"left\":(ww - ow)/2 > 0 ? (ww - ow)/2 :0\n");
	printf("	}).fadeIn(\"fast\");\n");
	
	printf("	$(window).wresize(function(){\n");
	printf("		var ww = $(window).width(), wh = $(window).height();\n");
	printf("	var ow = $(obj).width(), oh = $(obj).height();\n");
	printf("		var p = document.documentElement.scrollTop || document.body.scrollTop;\n");

	printf("		$(obj).css({\n");
	printf("			\"top\":(wh - oh)/2+p > 0 ? (wh - oh)/2+p : 0,\n");
	printf("		\"left\":(ww - ow)/2 > 0 ? (ww - ow)/2 :0\n");
	printf("		});\n");
	printf("	})\n");
	printf("}	\n");
	
	printf("function Cancel(){\n");
	printf("	closeDialog('#Dialog01');\n");
	printf("}\n");


	printf("function key_del(key){\n");
	printf("	confirm(\"确定删除吗?\",function(){\n");
	printf("	document.frm.delstr.value = key;\n");
//	printf("	document.frm.action = 'key_management.cgi';\n");
	printf("	document.frm.tasktype.value = 1;\n");
	printf("	document.frm.submit();\n");
	printf("	});\n");
	printf("}\n");


	printf("function getkeyplanTotalStr(count){\n");
	printf("	var i;\n");
	printf("	var objd;\n");
	printf("	document.frm.delstr.value = '';\n");
	printf("	for(i=0;i<count;i++){\n");
	printf("		objd  = document.getElementById(\"d_\"+i);\n");
	printf("		if(objd.checked == true){\n");
	printf("			document.frm.delstr.value += objd.value + \",\";\n");
	printf("		}\n");
	printf("	}\n");
	printf("	document.frm.tasktype.value = 1;\n");
	printf("	document.frm.submit();\n");
	printf("}\n");
	
	
//备注保存检查
	printf("function Remark_Save(){\n");
	printf("	if($(\"#keyname\").val()==\"\"){\n");
	printf("		alert('请填写公钥名称!');\n");
	printf("		return false;\n");
	printf("	}\n");	
	printf("	if($(\"#description\").val()==\"\"){\n");
	printf("		alert('请填写操作内容!');\n");
	printf("		return false;\n");
	printf("	}\n");
	printf("\n");						
	printf("	if($(\"#description\").val().length>1023) {\n");
	printf("		//value=value.substr(0,255);\n");
	printf("		alert('输入字符已达到最大值!');\n");
	printf("		return false;\n");
	printf("	}\n");
	
	printf("	var Cts = $(\"#description\").val();\n");
	printf("	if(Cts.indexOf(\"\\n\") >= 0 ) {\n");
	printf("		alert('公钥名称('+$(\"#keyname\").val()+')输入字符有特殊符号换行符!');\n");
	printf("		return false;\n");
	printf("	}\n");	

	
	
	printf("	document.frm.tasktype.value = 3;\n");
	printf("	document.frm.description.value=$(\"#description\").val();\n");
	printf("	document.frm.keyname.value=$(\"#keyname\").val();\n");
	printf("	 document.frm.submit();	\n");	
	printf("}\n");	
	
	printf("function closeDialog(obj){\n");
	printf("$(obj).hide();\n");
	printf("}\n");
	
	printf("</script>\n");
	printf("</html>\n");
	printf("<style type='text/css'> \n");
	printf("#ConnectHTML select{margin:4px 0 0 0;}\n");
	printf("span.kill{word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}\n");

	printf(".fdialog{width:820px;height:280px;overflow:hidden;border-radius:5px;}\n");
	printf(".fdialog .dialog-bg{width:2000px;height:2000px;background:#036;opacity:0.8;filter:alpha(opacity=80);}\n");
	printf(".fdialog .dialog-cont{width:800px;height:auto;overflow:hidden;margin:10px;padding:0;}\n");
	printf(".fdialog .dialog-title,.fdialog .dialog-content{width:100%%;}\n");
	printf(".fdialog .dialog-content{height:auto;border:0;padding:0;}\n");

	printf(".diag{position:absolute; top:50%%; left:50%%; width:585px; margin-left:-29px; margin-top:-145px;z-index:100; display:none;}\n");
	printf(".diag1{background:url(/bh/images/dialog_bg01.gif) 0 0 no-repeat; padding-top:10px;float:left;}\n");
	printf(".diagh{border-left: #d8d8d8 1px solid; width: auto; border-right: #d8d8d8 1px solid; margin:0 12px 0 11px; width:560px; float:left;}\n");
	printf(".diag_main{background:url(/bh/images/dialog_bg01_h.gif) 0 0 repeat-y;overflow:hidden;float:left;width:585px; }\n");
	printf(".diag_main_c{margin:0 12px 0 11px; height:200px;overflow:hidden; overflow-y:auto; float:left; width:560px;}\n");
	printf(".TypeList{overflow-y:auto; padding: 5px 10px;}\n");
	printf(".TypeList li{ line-height:26px;}\n");
	printf(".diag_btn{width:100%%; text-align:center;}\n");
	printf(".diag_footer{background:url(/bh/images/dialog_bg01.gif) 0 -179px no-repeat; height:10px; float:left; width:585px;}\n");
	printf(".baobiaoremove{ margin-top:5px;}\n");
	printf("#zhezhao{position:absolute;top:0;left:0;width:100%%;height:100%%;overflow:hidden;background:#FFF;z-index:98;filter:alpha(opacity=30);-moz-opacity:0.3; -khtml-opacity: 0.3; opacity:0.3; display:none;}\n");
	printf("</style>\n");	
	
	node = head;
	while (node){
		ManagementList *tmp;
		if(node->name) free(node->name);
		tmp = node;
		node = node->next;
		free(tmp);
	}	
}

int main(){
	int ret, tasktype = 0, public_key = 0, d_all = 0;
	u_int64 session;
	char *description = NULL, *keyname = NULL, *delstr = NULL;
	char sql[256] ,cuser[256];	
	
	memset(cuser,0,sizeof(char)*256);
	memset(sql,0,sizeof(char)*256);	
	
	
	printf("Content-type:text/html\n\n");

	if ((ret = CGIArgLoad("Ldssdds","session", &session, "tasktype", &tasktype, "description", &description, "keyname", &keyname, "d_all", &d_all, "public_key", &public_key, "delstr", &delstr))){
		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('服务器错误(%d)',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", ret, session);
		return 0;
	}


	if (CommandSessionCheck(session, cuser, NULL)){
		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('系统超时',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);
		goto _END_;
	}

	if (!cuser){
		printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('get user error',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>", session);
		goto _END_;
	}

	
	if(tasktype == 3){//添加
		if((ret = ManListAdd(cuser, description, keyname, public_key))!=0){
			printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('添加失败(%d)',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>\n", ret, session);
			goto _END_;
		}
	}	
	

	if(tasktype == 2){//保存
		if((ret = Pub_keySet(public_key, cuser))!=0){
			printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('保存失败(%d)',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>\n", ret, session);
			goto _END_;
		}else{
			printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('保存成功',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>\n", session);
			goto _END_;
		}
	}


	if(tasktype == 1){
		if(NULL != delstr){
			if((ret = Delstr(public_key, cuser, delstr))!=0){
				printf("<html><head><link href=\"/bh/style/stystem.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><script src=\"/bh/pjs/jquery-1.4.2.min.js\" type=\"text/javascript\"></script><script>alert('删除失败(%d).',function(){location.href='key_management.cgi?session=%llu';});</script></body></html>\n", ret, session);
				goto _END_;
			}
		}
	}
	

	showhtml(session,cuser);

_END_:	
	CGIArgFree();
	return 0;
}
  • 大小: 14.3 KB
  • 大小: 8.9 KB
  • 大小: 1.8 KB
  • 大小: 5.7 KB
分享到:
评论

相关推荐

    基于ssm校园一卡通密钥管理系统.zip

    【标题】"基于ssm校园一卡通密钥管理系统"是一个集成Spring、SpringMVC和MyBatis(简称SSM)的Java项目,旨在为校园提供一个安全、便捷的一卡通密钥管理解决方案。该项目可能涉及到了学生的日常生活消费、门禁、图书...

    Nacos 管理平台默认密钥.pdf

    ### Nacos 管理平台默认密钥安全性分析与加固方案 #### 一、Nacos 平台简介 Nacos 是阿里巴巴开源的一款易于构建云原生应用的动态服务发现、配置管理和服务管理平台。它提供了丰富的功能来支持现代微服务架构下的...

    阿里云 专有云企业版 V3.6.0 密钥管理服务KMS 技术白皮书 - 20180824.pdf

    "阿里云 专有云企业版 V3.6.0 密钥管理服务KMS 技术白皮书" 以下是根据给定的文件信息所生成的相关知识点: 一、阿里云专有云企业版密钥服务KMS技术白皮书概述 * 阿里云专有云企业版密钥服务KMS技术白皮书是一份...

    远程费控系统与密钥系统

    远程费控系统是以国家电网智能电能表信息交换安全认证技术规范为标准,实现电能表充值、密钥更新、参数修改、数据回抄、远程控制等功能。 二、操作说明 运行Prj_Ycfk.exe,打开如下界面。 2.1串口配置 单击菜单...

    实现使用3des在页面js加密,后台java解密

    在生产环境中,通常使用密钥管理系统(KMS)来安全地存储和管理密钥。 - **数据完整性**:使用哈希或消息认证码(MAC)确保数据在传输过程中未被篡改。 - **安全通信**:使用HTTPS等安全协议进行数据传输,防止中间...

    webshell连接工具冰蝎2.0,后面有三点零的,找一找再发

    【标题】中的“webshell连接工具冰蝎2.0”指的是一个用于远程管理Web服务器的后门工具,通常被安全研究人员或渗透测试人员用来模拟黑客攻击行为,以检测和修复系统漏洞。冰蝎是一个功能强大的Web后门客户端,它允许...

    设计扩展以使用密钥而不是密码_Ruby_HTML_下载.zip

    6. **示例代码和文档**: 可能包含详细的代码示例,演示如何在Rails应用中安装和配置这个gem,以及相关的HTML页面或API接口定义,帮助开发者理解如何在前端实现密钥验证流程。 这个项目为Ruby on Rails开发者提供了...

    js4ecdh.rar基于javascript的ecc的会话密钥协商

    例如,不正确的密钥管理或使用不安全的随机数生成器可能导致密钥泄露。此外,由于JavaScript代码运行在客户端,可能存在被浏览器插件或恶意脚本篡改的风险,因此在实际部署时,应当结合HTTPS等服务器端加密措施,以...

    购物车设计与实现(用户登录、注册、管理员登陆、显示商品)

    管理员通常拥有更高的权限,因此登录验证更严格,可能需要额外的密钥或两步验证。管理员界面应具备清晰的数据统计和操作功能,以便高效管理网站。 3. 商品展示: 商品展示涉及前端UI设计和后端数据获取。前端需要...

    在html页面使用excel的在线编辑

    在HTML页面上实现Excel的在线编辑是一项常见的需求,特别是在企业级应用中,用户可能需要在网页上直接查看、编辑和保存Excel数据。本教程将详细讲解如何在HTML页面上集成Excel在线编辑功能,并重点关注免费的基本...

    2.web表单使用及登录页面实现1

    在本教程中,我们将探讨如何利用Flask-WTF创建配置文件、加载配置、构建用户登录表单以及实现登录页面。下面我们将详细讲解每个步骤: 1. **config配置文件创建及配置** - 在Flask应用中,通常会创建一个单独的...

    用Flask实现的图书管理系统,数据库期中作业

    【标题】:基于Flask的图书管理系统实现 在IT领域,Web开发是不可或缺的一部分,而Python的Flask框架因其轻量级、灵活的特性而深受开发者喜爱。本项目是一个使用Flask实现的图书管理系统,旨在帮助用户管理和检索...

    微信小程序实现bilibili小程序简单页面源码

    - 微信小程序采用数据驱动的方式,通过`data`对象来管理页面状态,并使用双大括号`{{ }}`进行数据绑定。 - 事件处理通过在WXML中添加事件绑定,然后在对应的JS文件中编写事件处理函数,例如`bindtap`、`bindinput`...

    7实战篇 4:天气页面数据获取和交互实现(2).md

    这部分知识的掌握是开发天气小程序的基础,它不仅包括了API的使用,还涉及到坐标系统的理解和选择、密钥管理以及对API文档的正确解读。开发者需要通过这两个环节的实现,获得用户的精确位置,并根据这个位置来获取...

    商品后台管理源码 电子商务网站

    本源码旨在实现商品管理的各项功能,包括添加商品、删除商品、更新商品信息以及查询商品详情,确保平台的正常运行和用户购物体验。 首先,我们要理解商品后台管理系统的基本架构。通常,它由以下几个关键模块构成:...

    支付公钥秘钥的说明使用

    在“账户和密钥管理”页面中,可以看到用于配置公钥的选项。在设置应用公钥之前,需要先生成一对密钥对,即商户私钥(rsa_private_key.pem)和商户公钥(rsa_public_key.pem)。这些密钥可以通过密钥生成器生成。...

    AES算法实现Java和JS互通加解密

    总之,AES算法在Java和JavaScript之间的互通加解密是一个重要的实践,它涉及到密钥管理、数据格式转换、填充模式和初始化向量的处理。理解并正确实现这些细节,将有助于提升你的Web应用数据安全性能。

    百度搜索推送管理WP插件-提升博客页面百度收录效率

    主动推送-支持博主通过配置百度主动推送准入密钥,主动向Baidu提交网站新增、更新和删除内容URL。并且可查看最近三十天的推送数据及推送错误日志。 自动推送-支持博主直接开关按钮来配置百度主动推送功能。自动推送...

    如果接入腾讯云优图人脸识别.pdf

    腾讯云提供了密钥管理页面,您可以在这里申请密钥和管理密钥。请确保您定期更换密钥,以确保应用安全。 接入指南 为了帮助您快速接入腾讯云优图人脸识别服务,我们提供了以下接入指南: 1. 申请腾讯云帐号。 2. ...

Global site tag (gtag.js) - Google Analytics