盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

CGI图文说明教程(7)解码数据发送给CGI脚本之一

时间:2024/9/5作者:未知来源:盾怪网教程人气:

[摘要]hex(*from++);break;case '+' :ch = ' '; break;}*to++ = ch;}*to = '\0';}int P...
hex(*from++);

break;

case '+' :

ch = ' '; break;

}

*to++ = ch;

}

*to = '\0';

}

int Parse::hex( char c )

{

if ( isdigit( c ) )

return c-'0';

if ( isalpha( c ) )

return tolower(c)-'a'+10;

return 0;

}

char* Parse::map_uname( char *path )

{

#ifndef NO_MAP

if ( path[0] == '~' )

{

char uname[255]; // 容纳用户名字的变量

char *rest = &path[1];

char *p = &uname[0];

while ( *rest != '/' && *rest != '\0' )

{

*p++ = *rest++;

}

*p = '\0'; // 结束标识

char *root = uname;

passwd *pw = getpwnam( uname );

if ( pw != NULL )

{

root = pw->pw_dir; // 用户的主目录

}

int len_root = strlen(root);

int len_path = len_root + strlen(rest);

char *new_path = new char[len_path+1]; // 动态字符

strcpy( &new_path[0], root ); // 复制用户路径

strcpy( &new_path[len_root], rest ); // 其余部分

return new_path;

} else {

return path;

}

#endif

return path;

}

#endif



关键词:CGI图文详细教程(7)解码数据发送给CGI脚本之一




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版