<?php include "flag.php"; $year = $_GET['year']; if($year==2022 && $year+1!==2023){ echo $f...

这是一段PHP代码。代码中包含了一个include语句,用来包含一个名为flag.php的文件。代码还定义了一个变量$year,该变量的值来自于GET请求中的参数year。最后,代码还有一个if语句,判断$year的值是否等于2022。如果是,则执行if语句中的代码。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
用c编写一个,#include <stdio.h> #include <string.h> #define N 100 struct birth { int year; int month; int day; }; struct person { char ID[19]; char name[20]; struct birth birthday; int flag;//校验位是否正确, 1代表正确,0代表错误 }; int read(struct person p[]) { FILE *fp; int count=0; fp=fopen("person.txt",'r'); if(fp==NULL){ printf("Failed to open file.\n"); return -1; } while(fscanf(fp,"%s%s%d%d%d%d",p[count].ID,p[count].name, &p[count].birthday.year,&p[count].birthday.month, &p[count].birthday.day,&p[count].flag)!=EOF){ count++; } fclose(fp); return count; } int checkID(char *ID) { int weight[18]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};//ID号码权重 char checkcode[11]={1,0,'X',9,8,7,6,5,4,3,2};//校验码字符 int sum=0;//加权和 int i; if(strlen(ID)!=18){ return 0; } for(i=0;i<17;i++){ if(!isdigit(ID[i])){//isdigit=? return 0; } } for(i=0;i<17;i++){ // sum+=ID[i]*weight[i]; sum+=(ID[i]-'0')*weight[i]; } int code; code=sum%11; if(ID[17]==checkcode[code]){ return 1; } else{ return 0; } } struct birth get_birth(char *ID) { int i,j; struct birth b; char year_s[5]={0}, month_s[3]={0}, day_s[3]={0}; for(i=6,j=0;j<4;i++,j++){ year_s[j]=ID[i]; } for(i=10,j=0;j<2;i++,j++){ month_s[j]=ID[i]; } for(i=12,j=0;j<2;i++,j++){ day_s[j]=ID[i]; } //将字符串转换为整型 b.year=(year_s[0]-'0')*1000+(year_s[1]-'0')*100+ (year_s[2]-'0')*10+(year_s[3]-'0'); b.month=(month_s[0]-'0')*10+(month_s[1]-'0'); b.day=(day_s[0]-'0')*10+(day_s[1]-'0'); return b; } void get_all_person(struct person p[], int n) { int i; for(i=0;i<n;i++){ struct birth b=get_birth(p[i].ID); if(checkID(p[i].ID)){ p[i].birthday=b; p[i].flag=1; } else{ p[i].flag=0; } } }void save(struct person p[],int n); 将身份证号码正确的数据(身份证号码、姓名、出生年月日)写入文件person_checked.txt的函数。其中数组 p 中存放 n 个公民信息。
最新发布
05-18

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值