当前位置:首页 » 编程语言 » c语言编写超级管理员功能
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

c语言编写超级管理员功能

发布时间: 2022-08-26 16:51:36

Ⅰ 帮帮忙。。用c语言做一个管理员登录系统,并且可以修改密码。。

c不善于做页面类,逻辑性简单,建议用C++/C#可视化强,

Ⅱ 怎样用c语言编一个程序,使其只要运行即获得管理员权限。(在win7系统下)

emmm,我记得microsoft三件套就有这个特性
给一个从CSDN找到的代码
#include windows.h//这里自己加上括号

VOID ManagerRun(LPCSTR exe,LPCSTR param,INT nShow=SW_SHOW)
{ //注意:会跳出提示。
SHELLEXECUTEINFO ShExecInfo;
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS ;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = "runas";
ShExecInfo.lpFile = exe;
ShExecInfo.lpParameters = param;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = nShow;
ShExecInfo.hInstApp = NULL;
BOOL ret = ShellExecuteEx(&ShExecInfo);
//等不及了,不等了。
CloseHandle(ShExecInfo.hProcess);
return;
}
int main(int argc,char *argv[])
{
if(argc == 1) //初次运行,即双击EXE
{
ShowWindow(GetConsoleWindow(),SW_HIDE);
ManagerRun(argv[0],"2");
return 1;
}else if(argc == 2) //再次运行,即上面那个ManagerRun
{
/*你的程序主代码在此*/
}
return 0;
}

Ⅲ 我用C语言写了一个图书管理系统的代码,想加一个管理员登陆的功能,有没有大神知道怎么在运行程序的时候

这个函数就好了,输入管理员账号密码,然后用strcmp判断是否相等

Ⅳ 用c语言编写设计,职工信息管理系统。

我给你个大概提示吧,
首先你要做的是个大体的框架
分三个权限一是管理员权限,人事部门权限以及员工权限。
1.管理员权限实现包括员工基本信息增删改查功能。
2.人事权限包括员工拓展信息,比如工资,奖金等等数据的维护和更新。
3.员工权限包括个人信息查询以及问题反馈。
三个双向链表,节点数据存入以上所有信息。
链表操作不多说了吧。。。
文件读写问题,这里考虑到如果是一般情况的话直接调用readwrite函数就行了
如果内容过多还是连接数据库吧。
系统开始的初始化和更新也很重要。

Ⅳ 如何使用C语言编写图书管理系统

图书管理系统是运行于Windows系统下的应用软件,主要用于对图书馆中的图书信息进行增、删、改、查等操作,并且还可对使用该系统的用户进行登录名和密码的管理等。系统给用户提供了一个简单的人机界面,使用户可以根据提示输入操作项,调用系统提供的管理功能。
所需功能类似于学生成绩管理系统,界面可参考附录C。用户分为管理员和一般人员两大类。
功能需求描述如下。
①用户登录:根据用户输入的用户名和密码判断是否允许该用户使用本系统,并且当用户登录后根据用户权限判断用户可以使用哪些功能。学生只有浏览等权限而不能进行实质性改动。
②提供系统主控平台:系统主控平台也应根据用户权限不同而有所区别,只列出在用户权限范围内的功能供用户选择。系统主控平台包括输入功能选项、调用相应程序两大需求。教师和学生对应的系统主控平台是不同的。所能进行的操作也不相同。
③创建图书信息文件:用户根据提示输入图书编号、图书分类号、书名、作者姓名、出版社名、出版年月、定价、存库数量和借阅和上架情况等等信息存储在系统磁盘的文件中。以便进行管理、查找和备份。
④增加图书信息:可在原有图书信息文件的基础上增加新的图书信息记录并继续保存至磁盘,并且将增加后的文件存储状况显示给用户。
⑤删除图书信息:提示用户输入要进行删除操作的图书编号,如果在文件中有该信息存在,则将该书号所对应的记录删除。并选择是否继续进行删除操作。
⑥修改图书信息:提示用户输入要进行修改操作的书号,如果在文件中有该息存在,则将提示用户输入该书号对应的要修改的选项,结果存储于文件。该部分需求也需要提示用户选择是否继续进行修改操作。
⑦查询图书信息:提供按书号或书名等查询。在该功能中,也需提示用户是否需要继续查再继续查找,则返回主界面。
⑧一般用户查询个人的借阅情况并按日期进行排序:。
⑨管理员和一般用户管理:管理员对用户的管理也需要进行用户的创建、增加、删除、浏览。管理员创建的用户存储在名为yonghu的磁盘文件中,每当有用户登录系统时,会根据该文件中的用户名和密码进行核实判断,用户才能够顺利登录。管理员还具有用户的功能。增加的用户及密码、权限等也被继续存储在yonghu文件中。当某些用一用该系统时,还可以进行删除操作,并且管理员具有修改用户权限的功能,一般用户和管理员对于系统的权限是不一样的。

Ⅵ 怎样用c语言编一个程序,使其只要运行即获得管理员权限。(win7及以上系统)​

如果不使用系统级漏洞,这个是不可能操作。所谓栈内存溢出攻击是使用了系统漏洞,而且在不同电脑上效果也大相径庭,
所谓管理员权限地址是不存在的,没有这个说法,只有虚拟地址和实地址

就算你获得了管理员权限,也无法随便删除系统文件,要删除系统文件需要做很多工作,没有一个高权限驱动或服务也是没办法的

Ⅶ c语言 学生管理系统

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

struct Node//定义链表结点
{

char* class_0;//班级
int number;
char* name;//姓名
float elec;//电子技术成绩
float c_prog;//C程序设计成绩
float media;//多媒体技术成绩
float eng;//大学英语成绩
float math;//高等数学成绩
float sport;//大学体育成绩
float polity;//马克思主义政治经济学成绩
float ave;//平均成绩
int order;//名次
Node* link;
Node(){link=NULL;}
Node(int _number,char* _class_0,char* _name,float _elec,
float _c_prog,float _media,float _eng,float _math,
float _sport,float _polity,float _ave,int _order,Node* next)
{
number=_number;
class_0=new char[21];
strcpy(class_0,_class_0);
name=new char[9];
strcpy(name,_name);
elec=_elec;
c_prog=_c_prog;
media=_media;
eng=_eng;
math=_math;
sport=_sport;
polity=_polity;
ave=_ave;
order=_order;
link=next;
}
~Node()
{
delete []class_0;
delete []name;
}

};
class StudentScore
{
private:
Node* first;//链表的头指针
int choice;//选择数据的读入方式
int fileNum;//当前文件数减一
int fileLoc;//定位当前文件
string* fileName;
int operChoice;
int RecordLength;
public:
StudentScore();
void Save();
void BuildList();//手工建立成绩链表
void ReadInfo(int k);//从内存中读入学生信息
void ClearList();
void Statistic();
void Sort();
void Add();
void Delete();
void PrintList();
void Menu();
};
StudentScore::StudentScore()
{
RecordLength=0;
operChoice=0;
first=NULL;
choice=0;
fileLoc=0;
fileNum=0;
fileName=new string[10];//最多可以存10个文件
}
int GetOrder(Node* first,float ave);
void StudentScore::BuildList()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}
}
int GetOrder(Node* first,float ave)//名次记录有严重问题
{
int order=1;
Node* temp=first;
for(;temp;temp=temp->link)
{ if(temp->ave>ave) order++;
if(temp->ave<ave) (temp->order)++;
}
return order;
}

void StudentScore::Statistic()
{
Node* temp=first;
float a_elec=0.0;//电子技术成绩
float a_c_prog=0.0;//C程序设计成绩
float a_media=0.0;//多媒体技术成绩
float a_eng=0.0;//大学英语成绩
float a_math=0.0;//高等数学成绩
float a_sport=0.0;//大学体育成绩
float a_polity=0.0;//马克思主义政治经济学成绩
int i=0;
while(temp)
{
a_elec+=temp->elec;
a_c_prog+=temp->c_prog;
a_media+=temp->media;
a_eng+=temp->eng;
a_math+=temp->math;
a_sport+=temp->sport;
a_polity+=temp->polity;
i++;
temp=temp->link;
}
a_elec=a_elec/i;
a_c_prog=a_c_prog/i;
a_media=a_media/i;
a_eng=a_eng/i;
a_math=a_math/i;
a_sport=a_sport/i;
a_polity=a_polity/i;
cout<<"电子技术平均成绩为:"<<a_elec<<endl;
cout<<"c程序设计平均成绩为:"<<a_c_prog<<endl;
cout<<"多媒体技术平均成绩为:"<<a_media<<endl;
cout<<"英语平均成绩为:"<<a_eng<<endl;
cout<<"高等数学平均成绩为:"<<a_math<<endl;
cout<<"体育平均成绩为:"<<a_sport<<endl;
cout<<"政治平均成绩为:"<<a_polity<<endl;
}
void StudentScore::Delete()
{
int studNum;
Node* p;
Node* temp=first;
cout<<"请输入要删除的学生学号"<<endl;
cin>>studNum;
float average;
for(;temp;temp=temp->link)
{
cout<<temp->number;

if(temp->number==studNum)
{
average=temp->ave;

if(temp==first)//说明是第一次
{
first=first->link;
delete temp;
break;//如果不跳出的话 temp=temp->link会出错
}
else
{
p->link=temp->link;
delete temp;
break;
}
}
p=temp;
RecordLength--;

}
//下面修改学生排名
temp=first;
for(;temp;temp=temp->link)
if(temp->ave<average) temp->order--;

}
void StudentScore::Add()
{
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
char c;
Node *p,*r=NULL;
r=first;
while(r->link)
r=r->link;

// first=NULL;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
while(tolower(c)!='n')
{
cin>>_class_0;//班级
cin>>_number;
cin>>_name;//姓名
cin>>_elec;
cin>>_c_prog;
cin>>_media;
cin>>_eng;
cin>>_math;
cin>>_sport;
cin>>_polity;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
RecordLength++;
cout<<"您要输入学生成绩信息?"<<endl;
while((c=getchar())=='n');
}

}
void StudentScore::Sort()//简单bubble排序从高分到低分排序
{
int i=0;
Node* temp=first;
Node* before;
// Node* p=first;
for(;temp->link;)
{
if(temp->ave<temp->link->ave)
{

if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}

i++;//计算次数
}
for(;i>0;i--)
{
temp=first;
for(int j=0;j<i;j++)
{
if(temp->ave<temp->link->ave)
{
cout<<"small!"<<endl;
if(temp==first)//说明是第一个结点
{
first=first->link;
// p=temp;
// temp=temp->link;
temp->link=temp->link->link;
first->link=temp;
before=first;
}
else//不是第一个结点
{
before->link=temp->link;
temp->link=temp->link->link;
before->link->link=temp;
before=before->link;
}
}
else
{
temp=temp->link;
}
}
}

}
/*
bool IsSorted(Node* first)
{
for(;first;first=first->link)
if(first->ave<first->link->ave) return false;
return true;
}*/

void StudentScore::PrintList()//打印链表程序
{
cout<<"The list contains:"<<endl;
Node* temp=first;
for(;temp;temp=temp->link)
{
cout<<temp->class_0<<","<<temp->name<<endl;
cout<<temp->order<<endl;
}
}

void StudentScore::ClearList()//清除链表
{
Node* p=new Node;
while(first)
{
p=first->link;
delete first;
first=p;
}
}

//读函数
void StudentScore::ReadInfo(int k)//读第k个文件的信息存入链表
{
// int wordLength;//记录子段长度
int _number;//学号
char* _class_0=new char[21];//班级
char* _name=new char[9];//姓名
float _elec;//电子技术成绩
float _c_prog;//C程序设计成绩
float _media;//多媒体技术成绩
float _eng;//大学英语成绩
float _math;//高等数学成绩
float _sport;//大学体育成绩
float _polity;//马克思主义政治经济学成绩
float _ave;//平均成绩
int _order;//名次
Node *p,*r=NULL;
first=NULL;
ifstream Infile(fileName[k].c_str());
if(!Infile)
{
cout<<"file is not present!"<<endl;
return;
}
Infile>>RecordLength;
cout<<RecordLength;
for(int i=0;i<RecordLength;i++)
{
Infile>>_class_0;//班级
// cout<<_class_0;
Infile>>_number;
Infile>>_name;//姓名
Infile>>_elec;
Infile>>_c_prog;
Infile>>_media;
Infile>>_eng;
Infile>>_math;
Infile>>_sport;
Infile>>_polity;
Infile>>_ave;
Infile>>_order;
_ave=(_elec+_c_prog+_media+_eng+_math+_sport+_polity)/7;//求得平均成绩
//写一个返回排名的程序
_order=GetOrder(first,_ave);

p=new Node(_number,_class_0,_name,_elec,
_c_prog,_media,_eng,_math,_sport,_polity,
_ave,_order,NULL);//建立一个新的结点储存信息

if(first!=NULL)
r->link=p;
else first=p;
r=p;
}

}
void StudentScore::Save()
{
string tempName;
cout<<"请输入将要保存的文件名:"<<endl;
//要判断是否跟现有文件重名
cin>>tempName;
ofstream savefile(tempName.c_str());//要做一个转换
Node* temp=first;
savefile<<RecordLength<<endl;
for(;temp;temp=temp->link)
{
savefile<<temp->class_0<<" "<<temp->number<<" "<<temp->name<<" "<<temp->elec<<" "
<<temp->c_prog<<" "<<temp->media<<" "<<temp->eng<<" "<<temp->math<<" "
<<temp->sport<<" "<<temp->polity<<" "<<temp->ave<<" "<<temp->order<<endl;
}
savefile.close();

//读取文件表信息
ifstream Readfileinfo("FileRecord.txt");
Readfileinfo>>fileNum;
for(int i=0;i<fileNum;i++)
Readfileinfo>>fileName[i];
Readfileinfo.close();
fileNum++;
fileName[i]=tempName;
//修改文件表信息
ofstream changefile("FileRecord.txt");
changefile<<fileNum<<endl;
for(i=0;i<fileNum;i++)
changefile<<fileName[i]<<endl;
changefile.close();
}

void StudentScore::Menu()
{
cout<<"请您选择数据的读入方式:"<<endl;
cout<<"(1) 重新手动建立一份新的数据表"<<endl;
cout<<"(2) 从文件中读入数据"<<endl;
cout<<"请选择:";
cin>>choice;
if(choice==1)
{
BuildList();
}
if(choice==2)
{
cout<<"当前有如下文件,请选择读入文件:"<<endl;
ifstream fileRecord("fileRecord.txt");
if(!fileRecord)
{
cout<<"fileRecord is not present!"<<endl;
return;
}
fileRecord>>fileNum;
cout<<"当前有"<<fileNum<<"个文件:"<<endl;
for(int i=0;i<fileNum;i++)
{
fileRecord>>fileName[i];
cout<<fileName[i]<<" ";
}
cout<<"请您选择一个文件:";
cin>>fileLoc;
ReadInfo(fileLoc-1);
PrintList();

}
cout<<"请选择您需要的操作:"<<endl;
cout<<"(1) 统计学生各科成绩"<<endl;
cout<<"(2) 删除某个学生成绩记录"<<endl;
cout<<"(3) 增加某个学生成绩记录"<<endl;
cout<<"(4) 在链表中为所有学生成绩记录排序"<<endl;
cin>>operChoice;
if(operChoice==1)
Statistic();
if(operChoice==2)
Delete();
if(operChoice==3)
Add();
if(operChoice==4)
Sort();
Save();
ClearList();
}

int main()
{
cout<<"//////////////////////////////////"<<endl;
cout<<"欢迎使用学生成绩管理系统!"<<endl;
cout<<"//////////////////////////////////"<<endl;
cout<<endl;
cout<<endl;
StudentScore s;
s.Menu();
return 0;
}

Ⅷ 用c语言写个帐号管理系统(带注册的)分普通用户和管理员。。

用c语言实现不了,c语言是一种对数值操作的编程语言。
你要实现这个功能可以用c++builder,很好用。
看一看关于数据库方面,很简单。

Ⅸ 怎样在c语言代码中加入一个管理员登录界面不影响原来代码运行求代码

就加个函数而已。
void login()
{
printf("请输入帐号密码");
scanf("%s%s",&name,&pwd);
if(strcmp(name,s1)==0&&strcmp(pwd,s2)==0)
{
原来的函数;
}else
{
login();
}
}
int main()
{
login();
return 0;
}

Ⅹ c语言如何调用命令行并且是以管理员身份运行的命令行

这里要看具体情况,你最好能贴出具体的运行代码。
一般来说,如果你本身是一个控制台程序,那么zhuhuaizhong所说是一个合理的办法。
但如果本身是一个windows窗口程序,通过抛出方式运行一个命令行,那么应该采用如下几个办法之一:
1.
使用cmd的runas命令:runas
/user:user_name
program.exe
2.
创建外部命令行函数提权,要使用以下几个函数之一(其它如winexec等方式无法实现),它们都有runas类似功能:
CreateProcess
CreateProcessAsUser
CreateProcessWithLogonW
CreateProcessWithTokenW
如果是在win7下,CreateProcessWithLogonW是推荐使用的方式,具体代码请根据函数名搜索,不在这里粘贴了。