Three pages are created: (1) register new student information module (register. php ):! DOCTYPEHTMLPUBLIC-W3CDTDHTML4.01TransitionalENwww.w3.orgTRhtml4loose.dtdhtmlheadmetahttp-equivContent-Typecontenttexthtml; charsetgb2312title
Three pages are created: (1) register new student information module (register. php ):! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd" html head meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "title
Three pages are created:
(1) register the new information module (register. php ):
Class Registry
Henan University of Technology sincerely welcomes 2012 new students to study
New student registration system
(2) Information Query logon module (mysql_stu.php ):
New Login System <? Php // connect to the database; $ link = mysql_connect ('localhost', 'root', 'dongsheng'); if (! $ Link) {echo "failed to connect to the database! "; Die ('could not connect :'. mysql_error ();} $ createdb = "create database if not exists mis_stu"; $ result = mysql_query ($ createdb) or die ("
Database creation failed :". mysql_error (); $ result = mysql_select_db (mis_stu) or die ('failed to select mis_stu Database :'. mysql_error (); $ createtable = "create table if not exists stu_reg (stu_name varchar (30) not null, stu_sex char (2), stu_age int, stu_class varchar (30 ), stu_id varchar (18), stu_tele varchar (20), stu_email varchar (30) "; $ result = mysql_query ($ createtable) or die ('
Failed to create data table: '. mysql_error (); // select database mysql_select_db (mis_stu); if (! Empty ($ _ POST ['reg _ name']) {$ name = $ _ POST ['reg _ name']; $ sex = $ _ POST ['reg _ sex ']; $ age = $ _ POST ['reg _ age']; $ class = $ _ POST ['reg _ class']; $ id = $ _ POST ['reg _ id']; $ tele = $ _ POST ['reg _ tele ']; $ email = $ _ POST ['reg _ email']; // define the SQL string mysql_query ("set names gb2312") inserted into the stu_reg table; $ SQL = "insert into stu_reg (stu_name, stu_sex, stu_age, stu_class, stu_id, stu_tele, stu_email) values ('$ name',' $ sex ',' $ age', '$ class',' $ id', '$ tele',' $ email ') "; mysql_query ($ SQL); mysql_query (" COMMIT "); echo"
Congratulations! Registration successful!
Enter the following content to log on to the system to query registration information.
";}Mysql_close ($ link) ;?> Register before Logon
Information Query Logon
>
Requirements for new students:
Please complete the registration information at each school first,
Register reports,
At the same time, the electronic file information should be improved as required.
Hope that the majority of students can adapt to the new environment as soon as possible,
Meet new friends and get involved in learning as soon as possible!
Academic Affairs Office Tel: 12345678
Wei Ke Tel: 87654321
(3) Query Information Display Module (stu_info.php)
Basic Information <? Php if ($ _ POST ['Log _ name'] = '') {echo"
Name cannot be blank! Enter again!
"; Echo"
Log on again
";} Else {$ link = mysql_connect ('localhost', 'root', 'dongsheng '); if (! $ Link) {echo "failed to connect to the database! "; Die ('could not connect :'. mysql_error ();} $ result = mysql_select_db (mis_stu) or die ('failed to select mis_stu Database :'. mysql_error (); mysql_query ("set names gb2312"); $ slt = mysql_query ("select * from stu_reg"); $ arr = mysql_fetch_assoc ($ slt ); $ flag = 0; while ($ arr) {if ($ _ POST ['Log _ name'] = $ arr ['stu _ name']) {$ flag = 1; if ($ _ POST ['Log _ id'] = $ arr ['stu _ id']) {echo"Login successful. Your basic information is:
"; Echo" name: ". $ arr ['stu _ name']."
"; Echo" Gender: ". $ arr ['stu _ sex']."
"; Echo" age: ". $ arr ['stu _ age']."
"; Echo" class: ". $ arr ['stu _ class']."
"; Echo" id card number: ". $ arr ['stu _ id']."
"; Echo" contact number: ". $ arr ['stu _ tele']."
"; Echo" email: ". $ arr ['stu _ email ']."
"; Break;} else {echo"
Incorrect password! Enter again.
"; Break ;}$ arr = mysql_fetch_assoc ($ slt);} if ($ flag = 0) echo"
Sorry! The user you queried does not exist. Please return to registration first
"; Mysql_close ($ link); echo"
Switch user
";}?>