當前位置:首頁 » 編程語言 » 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是推薦使用的方式,具體代碼請根據函數名搜索,不在這里粘貼了。