主要是上站时间,很难改。
编个小程序。
放在bbs的目录下,和.PASSWDS在一起。
会要求输入用户名(区分大小写)
显示用户名及上站时间
输入想修改后的上站时间
显示修改后的上站时间
如果想修改其它资料,请修改相应的地方。
#include "stdio.h"
#include "time.h"
#include "string.h"
#include "ctype.h"
#define PASSFILE ".PASSWDS"
#define STRLEN 80
#define IDLEN 12
#define PASSLEN 14
#define NAMELEN 40
#define ENCPASSLEN 14
#define O_RDONLY "rb+"
struct userec { /* Structure used to hold information in */
char userid[IDLEN+2];
time_t firstlogin;
char lasthost[16];
unsigned int numlogins;
unsigned int numposts;
unsigned int nummedals; /* 奖章数 */
unsigned int money; /* 存款 */
unsigned int bet; /* 贷款 */
time_t dateforbet;
char flags[2];
#ifdef ENCPASSLEN
char passwd[ENCPASSLEN];
#else
char passwd[PASSLEN];
#endif
char username[NAMELEN];
char ident[NAMELEN];
char termtype[16];
char reginfo[STRLEN-16];
unsigned int userlevel;
time_t lastlogin;
time_t lastlogout;/* 最近离线时间 */
time_t stay;
char realname[NAMELEN];
char address[STRLEN];
char email[STRLEN-12];
unsigned int nummails;
time_t lastjustify;
char gender;
unsigned char birthyear;
unsigned char birthmonth;
unsigned char birthday;
int signature;
unsigned int userdefine;
time_t notedate;
int noteline;
} currentuser,tmp[500];
main()
{
int usernum=10;
char *filename;
char *rptr;
FILE *fd;
char uid[12];
int size, id,i;
time_t ustay;
fd = fopen("./.PASSWDS", "rb+");
rewind(fd);
printf("Please input the id:");
scanf("%s",uid);
printf("The info of '%s' is:\n",uid);
i=0;
while(!feof(fd))
{
i++;
fread(&tmp[i] , sizeof(currentuser),1,fd);
if (strcmp(tmp[i].userid, uid)==0)
{
printf("%12.12s\t",tmp[i].userid);
printf("%ld\n",tmp[i].stay);
printf("How much do you want it to be:\n");
scanf("%ld",&ustay);
printf("The time you input is : %ld",ustay);
fseek(fd,-sizeof(currentuser),1);
tmp[i].stay=ustay;
fwrite(&tmp[i] , sizeof(currentuser),1,fd);
printf("%12.12s\t",tmp[i].userid);
printf("%ld\n",tmp[i].stay);
}
}
fclose(fd);
}
--
FROM 166.111.34.163