diff --git a/xscjmanager/Login.php b/xscjmanager/Login.php new file mode 100644 index 0000000..4a20ba2 --- /dev/null +++ b/xscjmanager/Login.php @@ -0,0 +1,187 @@ + + + + +学生成绩管理系统登录 + + + + +alert(0)"; + +if(!empty($username)) +{ + $s_sql = "select * from user where username ='$username' and password='$password'"; + $s_result = $db->query( $s_sql); + if($s_result && $s_result->rowCount() != 0) + { + echo ""; + } + else + { + echo ""; + } +} +?> + + + +
+
+
+ +
+

登录

+
+ +
+ + +
+
+ + +
+
+
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/xscjmanager/body.html b/xscjmanager/body.html new file mode 100644 index 0000000..b9cc351 --- /dev/null +++ b/xscjmanager/body.html @@ -0,0 +1,11 @@ + + + + + 内容网页 + + + + \ No newline at end of file diff --git a/xscjmanager/fun.php b/xscjmanager/fun.php new file mode 100644 index 0000000..f3cd32d --- /dev/null +++ b/xscjmanager/fun.php @@ -0,0 +1,10 @@ + +getMessage(); + } +?> \ No newline at end of file diff --git a/xscjmanager/images/1.jpg b/xscjmanager/images/1.jpg new file mode 100644 index 0000000..e089961 Binary files /dev/null and b/xscjmanager/images/1.jpg differ diff --git a/xscjmanager/images/2.jpg b/xscjmanager/images/2.jpg new file mode 100644 index 0000000..dc0040a Binary files /dev/null and b/xscjmanager/images/2.jpg differ diff --git a/xscjmanager/images/BG.png b/xscjmanager/images/BG.png new file mode 100644 index 0000000..c16bb70 Binary files /dev/null and b/xscjmanager/images/BG.png differ diff --git a/xscjmanager/images/Background.jpg b/xscjmanager/images/Background.jpg new file mode 100644 index 0000000..d68305d Binary files /dev/null and b/xscjmanager/images/Background.jpg differ diff --git a/xscjmanager/images/top.png b/xscjmanager/images/top.png new file mode 100644 index 0000000..69ebe37 Binary files /dev/null and b/xscjmanager/images/top.png differ diff --git a/xscjmanager/index.php b/xscjmanager/index.php new file mode 100644 index 0000000..7abc7eb --- /dev/null +++ b/xscjmanager/index.php @@ -0,0 +1,15 @@ + + + + 学生成绩管理系统 + + + + + + +
+ + \ No newline at end of file diff --git a/xscjmanager/main.php b/xscjmanager/main.php new file mode 100644 index 0000000..a8ef730 --- /dev/null +++ b/xscjmanager/main.php @@ -0,0 +1,30 @@ + + + + +学生管理系统 + + + + + + + + \ No newline at end of file diff --git a/xscjmanager/main_frame.html b/xscjmanager/main_frame.html new file mode 100644 index 0000000..5d327a7 --- /dev/null +++ b/xscjmanager/main_frame.html @@ -0,0 +1,14 @@ + + + + + 学生成绩管理系统 + + + + + + +m \ No newline at end of file diff --git a/xscjmanager/scoreManage.php b/xscjmanager/scoreManage.php new file mode 100644 index 0000000..0f8d0d3 --- /dev/null +++ b/xscjmanager/scoreManage.php @@ -0,0 +1,160 @@ + + + + 成绩管理 + + +
+ + + + + + + + + + + + + + +
+ 课程名: + + + + + + + +
+ 姓名: +   + 成绩: + + + + +
+ + + + + + + + query(iconv('UTF-8', 'UTF-8', $cj_sql)); + + + if ($cj_result->rowCount() == 0) // 判断该学生是否存在 + + + + echo ""; + else { + + while (list ($XM, $CJ) = $cj_result->fetch(PDO::FETCH_NUM)) { // 获取查询结果集 + $Name = iconv('UTF-8', 'UTF-8', $XM); + // 在表格中显示输出"姓名-成绩"信息 + echo ""; + } + } + + } + ?> +
姓名成绩
$Name $CJ
+
+
+ + +query(iconv('UTF-8', 'UTF-8', $cj_sql)); + //单击【录入】按钮 + if(@$_POST["btn"] == '录入') { + if(empty($StudentName)||empty($Score)) + echo ""; + else { + if($result->rowCount() != 0) //查询结果不为空,表示该成绩记录已经存在 + echo ""; + else { //不存在才可以添加 + + $insert_sql = "insert into CJ(XM, KCM, CJ) values('$StudentName', '$CourseName', '$Score')"; //添加新记录 + $insert_result = $db->query(iconv('UTF-8', 'UTF-8', $insert_sql)); //执行操作 + if($insert_result->rowCount() != 0) + echo ""; + else + echo ""; + } + } + } + + //单击【删除】按钮 + if(@$_POST["btn"] == '删除') { + if($result->rowCount() != 0) { //查询结果不为空,该成绩记录存在可删除 + $delete_sql = "delete from CJ where XM ='$StudentName' and KCM ='$CourseName'"; //删除该记录 + $del_affected = $db->exec(iconv('UTF-8', 'UTF-8', $delete_sql)); //执行操作 + if($del_affected) + echo ""; + else + echo ""; + } + else //不存在该记录,无法删 + echo ""; + } + + if(@$_POST["btn"] == '更新'){ //单击"更新"按钮 + if($result->rowCount() != 0) { + $update_sql = "update CJ set CJ = $Score where XM = '$StudentName' and KCM = '$CourseName'"; + $update_affected = $db->exec(iconv('UTF-8', 'UTF-8', $update_sql)); + if($update_affected) + echo ""; + else + echo ""; + } + else + echo ""; + } +?> \ No newline at end of file diff --git a/xscjmanager/showpicture.php b/xscjmanager/showpicture.php new file mode 100644 index 0000000..fcb58f4 --- /dev/null +++ b/xscjmanager/showpicture.php @@ -0,0 +1,17 @@ + +query(iconv('UTF-8', 'UTF-8', $sql)); + //$result = mysql_query($sql); + list($ZP) = $result->fetch(PDO::FETCH_NUM); + //$row = mysql_fetch_array($result); + $image = base64_decode($ZP); //使用base64_decode()函数解码 + //$image = base64_decode($row['ZP']); //使用base64_decode()函数解码 + echo $image; //输出照片 +?> \ No newline at end of file diff --git a/xscjmanager/studentAction.php b/xscjmanager/studentAction.php new file mode 100644 index 0000000..08fb80a --- /dev/null +++ b/xscjmanager/studentAction.php @@ -0,0 +1,91 @@ + +query(iconv('UTF-8', 'UTF-8', $s_sql)); + + /**以下为各学生管理操作按钮的代码*/ + //录入功能 + if(@$_POST["btn"] == '录入') { //单击"录入"按钮 + + if($s_result->rowCount() != 0) //要录入的学生姓名已经存在时提示 + echo ""; + else { + if(!$tmp_file) { //没有上传照片的情况 + $insert_sql = "insert into XS values('$StudentName', $Sex, '$Birthday', 0, NULL, NULL)"; + }else { + $insert_sql = "insert into XS values('$StudentName', $Sex, '$Birthday', 0, NULL, '$Picture')"; + } + $insert_result = $db->query(iconv('UTF-8', 'UTF-8', $insert_sql)); + + if($insert_result->rowCount() != 0) { + $_SESSION['StuName'] = $StudentName; + echo ""; + }else + echo ""; + } + } + + //删除功能 + if(@$_POST["btn"] == '删除') { //单击"删除"按钮 + if($s_result->rowCount() == 0) //要删除的学生姓名不存在时提示 + echo ""; + else { //处理姓名存在的情况 + list($XM, $KCS) = $s_result->fetch(PDO::FETCH_NUM); + if($KCS != 0) //学生有修课记录时提示 + echo ""; + else { //删除操作 + $del_sql = "delete from XS where XM ='$StudentName'"; + $del_affected = $db->exec(iconv('UTF-8', 'UTF-8', $del_sql)); + if($del_affected) { + $_SESSION['StuName'] = 0; + echo ""; + } + } + } + } + + //更新功能 + if(@$_POST["btn"] == '更新'){ //单击"更新"按钮 + $_SESSION['StuName'] = $StudentName; //将用户输入的姓名用SESSION保存 + if(!$tmp_file) //若没有上传文件则不更新照片列 + $update_sql = "update XS set XB =$Sex, CSSJ ='$Birthday' where XM ='$StudentName'"; + else + $update_sql = "update XS set XB =$Sex, CSSJ ='$Birthday', ZP='$Picture' where XM ='$StudentName'"; + $update_affected = $db->exec(iconv('UTF-8', 'UTF-8', $update_sql)); + if($update_affected) + echo ""; + else + echo ""; + } + + + + //查询功能 + if(@$_POST["btn"] == '查询') { //单击"查询"按钮 + $_SESSION['StuName'] = $StudentName; //将姓名传给其他页面 + $sql = "select XM, XB, CSSJ, KCS from XS where XM ='$StudentName'"; //查找姓名对应的学生信息 + + $result = $db->query(iconv('UTF-8', 'UTF-8', $sql)); + if($result->rowCount() == 0) //判断该学生是否存在 + echo ""; + else { + list($XM, $XB, $CSSJ, $KCS) = $result->fetch(PDO::FETCH_NUM); + $_SESSION['XM'] = iconv('UTF-8', 'UTF-8', $XM); + $_SESSION['XB'] = $XB; + $_SESSION['CSSJ'] = $CSSJ; + $_SESSION['KCS'] = $KCS; + echo ""; + } + } +?> \ No newline at end of file diff --git a/xscjmanager/studentManage.php b/xscjmanager/studentManage.php new file mode 100644 index 0000000..4e10e77 --- /dev/null +++ b/xscjmanager/studentManage.php @@ -0,0 +1,105 @@ + + + + + + 学生管理 + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
姓名:
性别: + 男 + 女 + + 男 + 女 +
出生年月:
照片:
+ "; + ?> +
+ + + + +
+
+ + + + + + + +
已修课程
+ query(iconv('UTF-8', 'UTF-8', $cj_sql)); + $xmcj_sql = "select * from xmcj_view"; //从XMCJ_VIEW表中查询出学生成绩信息 + $cj_rs = $db->query($xmcj_sql); + //输出表格 + echo ""; + echo ""; + echo ""; + while(list($KCM, $CJ) = $cj_rs->fetch(PDO::FETCH_NUM)) { //获取成绩结果集 + $KC = iconv('UTF-8', 'UTF-8', $KCM); + echo ""; //在表格中显示输出"课程名-成绩"信息 + } + echo "
课程名成绩
$KC $CJ
"; + ?> + +
+
+
+ + \ No newline at end of file diff --git a/zhuce/.gitignore b/zhuce/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/zhuce/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/zhuce/.idea/.gitignore b/zhuce/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/zhuce/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/zhuce/.idea/.name b/zhuce/.idea/.name new file mode 100644 index 0000000..b3405b3 --- /dev/null +++ b/zhuce/.idea/.name @@ -0,0 +1 @@ +My Application \ No newline at end of file diff --git a/zhuce/.idea/compiler.xml b/zhuce/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/zhuce/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/zhuce/.idea/gradle.xml b/zhuce/.idea/gradle.xml new file mode 100644 index 0000000..23a89bb --- /dev/null +++ b/zhuce/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/zhuce/.idea/jarRepositories.xml b/zhuce/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/zhuce/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/zhuce/.idea/misc.xml b/zhuce/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/zhuce/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/zhuce/app/.gitignore b/zhuce/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/zhuce/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/zhuce/app/build.gradle b/zhuce/app/build.gradle new file mode 100644 index 0000000..975e7b1 --- /dev/null +++ b/zhuce/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "edu.hzuapps.myapplication" + minSdkVersion 21 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} \ No newline at end of file diff --git a/zhuce/app/proguard-rules.pro b/zhuce/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/zhuce/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/zhuce/app/src/androidTest/java/edu/hzuapps/myapplication/ExampleInstrumentedTest.java b/zhuce/app/src/androidTest/java/edu/hzuapps/myapplication/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c72537a --- /dev/null +++ b/zhuce/app/src/androidTest/java/edu/hzuapps/myapplication/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package edu.hzuapps.myapplication; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("edu.hzuapps.myapplication", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/zhuce/app/src/main/AndroidManifest.xml b/zhuce/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..789f37e --- /dev/null +++ b/zhuce/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zhuce/app/src/main/java/edu/hzuapps/myapplication/RegisterActivity.java b/zhuce/app/src/main/java/edu/hzuapps/myapplication/RegisterActivity.java new file mode 100644 index 0000000..14bd925 --- /dev/null +++ b/zhuce/app/src/main/java/edu/hzuapps/myapplication/RegisterActivity.java @@ -0,0 +1,88 @@ +package edu.hzuapps.myapplication; + +import android.app.Activity; +import android.content.ContentValues; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; +import edu.hzuapps.myapplication.sql.ZhuChe_sql; +public class RegisterActivity extends Activity { + + final edu.hzuapps.myapplication.RegisterActivity thisActivity = this; + + private Button button; + private EditText zh_edit; + private EditText mm_edit; + private EditText name_edit; + + private ZhuChe_sql zhuche_sql; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + + //数据库初始化 + zhuche_sql = new ZhuChe_sql(thisActivity); + //连接控件 + zh_edit = findViewById(R.id.注册_账号); + mm_edit = findViewById(R.id.注册_密码); + name_edit = findViewById(R.id.姓名); + button = findViewById(R.id.button); + jtq(button); + } + + //按钮监听器 + void jtq(Button b){ + b.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v){ + String zh,mm,name; + zh = zh_edit.getText().toString(); + mm = mm_edit.getText().toString(); + name = name_edit.getText().toString(); + if(zh.equals("") || mm.equals("") || name.equals("") ){ + Toast.makeText(thisActivity, "不允许为空!", Toast.LENGTH_SHORT).show(); + } + else if( find(zh) ) { + Toast.makeText(thisActivity, "该账号已被注册!", Toast.LENGTH_SHORT).show(); + } else{ + Insert(zh,mm,name); + } + } + }); + } + + //增添sql数据 + public void Insert(String zh,String mm,String name){ + //获取可读写对象 + SQLiteDatabase db = zhuche_sql.getWritableDatabase(); + ContentValues values = new ContentValues(); + values.put("zh",zh); + values.put("password",mm); + values.put("name",name); + //插入一条数据到information表 + long i=db.insert("myzh",null,values); + + //判断是否添加进数据库 + if(i==-1) + Toast.makeText(thisActivity,"添加失败",Toast.LENGTH_SHORT).show(); + else + Toast.makeText(thisActivity,"注册成功!",Toast.LENGTH_SHORT).show(); + db.close(); + } + + public boolean find(String zh){ + SQLiteDatabase db = zhuche_sql.getWritableDatabase(); + Cursor cursor = db.query("myzh",null,"zh=?",new String[] {zh+""},null,null,null); + boolean result = cursor.moveToNext(); + cursor.close(); + db.close(); + return result; + } +} \ No newline at end of file diff --git a/zhuce/app/src/main/java/edu/hzuapps/myapplication/sql/ZhuChe_sql.java b/zhuce/app/src/main/java/edu/hzuapps/myapplication/sql/ZhuChe_sql.java new file mode 100644 index 0000000..506e989 --- /dev/null +++ b/zhuce/app/src/main/java/edu/hzuapps/myapplication/sql/ZhuChe_sql.java @@ -0,0 +1,24 @@ +package edu.hzuapps.myapplication.sql; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +public class ZhuChe_sql extends SQLiteOpenHelper { + public ZhuChe_sql(Context context) { + super(context, "zc.db",null,2); + } + //数据库被第一次创建时调用该方法 + @Override + public void onCreate(SQLiteDatabase db) { + //账号 + db.execSQL("CREATE TABLE myzh (zh VARCHAR(20) PRIMARY KEY , password VARCHAR(20) NOT NULL , name VARCHAR(20) NOT NULL )"); + } + + //当数据库的版本号增加时调用 + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + + } + +} diff --git a/zhuce/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/zhuce/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/zhuce/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/zhuce/app/src/main/res/drawable/ic_launcher_background.xml b/zhuce/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/zhuce/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zhuce/app/src/main/res/layout/activity_register.xml b/zhuce/app/src/main/res/layout/activity_register.xml new file mode 100644 index 0000000..c8e5516 --- /dev/null +++ b/zhuce/app/src/main/res/layout/activity_register.xml @@ -0,0 +1,113 @@ + + + + +