├── PHPnow-1.5.6.zip
├── README.md
├── selectcoursesystem
├── Connections
│ ├── _notes
│ │ └── dwsync.xml
│ └── selectcoursesystem.php
├── _mmServerScripts
│ ├── MMHTTPDB.php
│ ├── _notes
│ │ └── dwsync.xml
│ └── mysql.php
├── _notes
│ ├── .mno
│ ├── add-class.php.mno
│ ├── changed-admin.php.mno
│ ├── course-del.php.mno
│ ├── course-stu.php.mno
│ ├── course-stu2.php.mno
│ ├── course-stu3.php.mno
│ ├── course-tea.php.mno
│ ├── delect.php.mno
│ ├── delete-stu.php.mno
│ ├── dwsync.xml
│ ├── manage-stu.php.mno
│ ├── manage-tea.php.mno
│ ├── modify-stu.php.mno
│ ├── modify-tea.php.mno
│ ├── search-tea.php.mno
│ ├── welcome-admin.php.mno
│ └── welcome-stu.php.mno
├── add-class.php
├── changed-admin.php
├── changed-stu.php
├── changed-tea.php
├── course-del.php
├── course-stu.php
├── course-stu2.php
├── course-stu3.php
├── course-tea.php
├── delect.php
├── delete-stu.php
├── index.php
├── login-admin.php
├── login-stu.php
├── login-tea.php
├── loginfailed.php
├── manage-stu.php
├── manage-tea.php
├── modify-stu.php
├── modify-tea.php
├── password-stu.php
├── password-tea.php
├── search-tea.php
├── style.css
├── welcome-admin.php
├── welcome-stu.php
└── welcome-tea.php
├── student.sql
├── 设计基于PHP的网上选课系统说明-kidaze.docx
└── 选课系统使用指南(包含测试账号).docx
/PHPnow-1.5.6.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kidaze/CourseSelectionSystem/42cd892b40a18d50bd4ed1905fa89f939173a464/PHPnow-1.5.6.zip
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CourseSelectionSystem
2 | 基于PHP的网上选课系统
3 | 针对选课系统,我主要使用了phpmyadmin + Dreamweaver完成了大部分工作
4 |
5 | 这是php老师发布的要求:
6 |
7 | “
8 |
9 | 设计一个《基于PHP的网上选课系统》
10 | 采用PHP,MYSQL,HTML设计一个基于B/S模式的选课系统,该系统的主要功能如下:
11 |
12 | 1、系统针对不同的用户角色进行管理,至少有以下三种角色:学生、教师、管理员。并提供以下主要功能:学生信息管理、课程管理、教师管理、学生选课管理等。
13 | 2、数据库采用MYSQL,至少包括以下五张表:
14 | 学生信息表(学号、姓名、所在院系ID、专业、性别、班级、密码);
15 | 课程信息(课程代码、课程名称、教师编号、已选人数、总人数、上课时间、地点、学分、讲授学时、实验学时);
16 | 教师信息表(教师编号、姓名、性别、所属学院、个人简介、密码);
17 | 学生选课管理(学号、姓名、所在学院、所在专业、班级、课程编码),
18 | 院系信息表(院系ID、院系名称、所在校区)。
19 | 3、教师登录后提供以下功能操作:发布课程,查询已发布课程,查询选课学生信息,修改密码。
20 | 4、学生登录后提供以下功能操作:查看可选课程,选择课程,查询已选课程,退选课程,修改密码。
21 | 5、管理员登录后提供以下功能操作:管理学生信息,管理教师信息,修改密码。
22 |
23 | ”
24 |
25 | 使用前先阅读使用指南会更方便您的使用,谢谢!
26 |
--------------------------------------------------------------------------------
/selectcoursesystem/Connections/_notes/dwsync.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/selectcoursesystem/Connections/selectcoursesystem.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/selectcoursesystem/_mmServerScripts/MMHTTPDB.php:
--------------------------------------------------------------------------------
1 | Your testing server do not has support for PHP pages\n
2 |
3 | $debug_to_file = false;
4 |
5 | function log_messages($error_message){
6 | global $f, $debug_to_file;
7 | if ($debug_to_file === true){
8 | if (!is_resource($f)){
9 | @ini_set('display_errors', 1);
10 | @error_reporting(E_ALL);
11 | $f = @fopen('log.txt', 'a');
12 | }
13 | if (is_resource($f)){
14 | return @fwrite($f, $error_message."\n");
15 | }
16 | }
17 | return false;
18 | }
19 | function create_error($error_msg = '', $line = -1){
20 | if ($error_msg != ''){
21 | return ''.$error_msg.'\n';
22 | }else{
23 | return ' Unidentified Connection Error at Line '.$line.'\n';
24 | }
25 | }
26 |
27 | log_messages("\n--------------------------------");
28 | // what parameters were sent ?!
29 | foreach($_POST as $key=>$value) {
30 | if (strtoupper($key) != 'PASSWORD'){
31 | log_messages('$_POST["'.$key.'"] = \''.$value."';");
32 | }
33 | }
34 | // We need these information only once when the test button is hit
35 | if (isset($_POST['opCode']) && $_POST['opCode'] == 'IsOpen' ){
36 | // What PHP version
37 | log_messages("\nPHP-Version: ".phpversion());
38 | // What OS System is running on
39 | log_messages('PHP-OS: '.PHP_OS);
40 | // How PHP is installed (CGI, ISAPI, FastCGI)
41 | // !!!! Major difference exists on these servers for $_ENV, $_SERVER
42 | log_messages('PHP-SAPI-NAME: '.php_sapi_name());
43 | // MySQL, mbstring modules are installed ?!
44 | log_messages('PHP-Extensions: '.var_export(get_loaded_extensions(),true));
45 | }
46 |
47 | if(extension_loaded('mbstring'))
48 | {
49 | $acceptCharsetHeader = 'Accept-Charset: ' . mb_internal_encoding();
50 | header( $acceptCharsetHeader );
51 | $head = '
';
52 | echo $head;
53 | }else{
54 | echo '';
55 | }
56 |
57 | // Build connection object
58 | if (isset($_POST['Type']) && $_POST['Type'] == 'MYSQL')
59 | {
60 | require("./mysql.php");
61 | $oConn = new MySqlConnection(@$_POST['ConnectionString'], @$_POST['Timeout'], @$_POST['Host'], @$_POST['Database'], @$_POST['UserName'], @$_POST['Password']);
62 | if (!isset($oConn) || $oConn == false){
63 | log_messages("\n".'MySQL Connection Object initialisation failed'."\n\n".@$error);
64 | }else{
65 | log_messages("\n".'MySQL Connection Object Created'."\n\n");
66 | }
67 | }else{
68 | $error=create_error('The files from the _mmServerScripts folder are for the server model PHP-MySQL. You try to connect to a database using a different server model '.@$_POST['Type'].".\n\nPlease remove this folder outside the Dreamweaver environment on both local and testing machines and try again.",__LINE__);
69 | log_messages("\nError Sent:\n\n\t".@$error."\n\n\n");
70 | echo $error.'';
71 | return;
72 | }
73 |
74 | // Process opCode
75 | if (isset($oConn) && $oConn)
76 | {
77 | $oConn->Open();
78 |
79 | if ($_POST['opCode'] == 'IsOpen'){
80 | $answer = $oConn->TestOpen();
81 | }elseif (is_resource($oConn->connectionId) && $oConn->isOpen){
82 |
83 | switch ($_POST['opCode']){
84 | case 'GetTables': $answer = $oConn->GetTables(@$_POST['Database']); break;
85 | case 'GetColsOfTable': $answer = $oConn->GetColumnsOfTable(@$_POST['TableName']); break;
86 | case 'ExecuteSQL': $answer = $oConn->ExecuteSQL(@$_POST['SQL'], @$_POST['MaxRows']); break;
87 | case 'GetODBCDSNs': $answer = $oConn->GetDatabaseList(); break;
88 | case 'SupportsProcedure': $answer = $oConn->SupportsProcedure(); break;
89 | case 'GetProviderTypes': $answer = $oConn->GetProviderTypes(); break;
90 | case 'GetViews': $answer = $oConn->GetViews(); break;
91 | case 'GetProcedures': $answer = $oConn->GetProcedures(); break;
92 | case 'GetParametersOfProcedure': $answer = $oConn->GetParametersOfProcedure(@$_POST['ProcName']); break;
93 | case 'ReturnsResultset': $answer = $oConn->ReturnsResultSet($_POST['RRProcName']); break;
94 | case 'ExecuteSP': $answer = $oConn->ExecuteSP(@$_POST['ExecProcName'], 0, @$_POST['ExecProcParameters']); break;
95 | case 'GetKeysOfTable': $answer = $oConn->GetPrimaryKeysOfTable(@$_POST['TableName']); break;
96 | default: $answer = create_error('The \''.$_POST['opCode'].'\' command is not supported.'); break;
97 | }
98 | }
99 |
100 | $oConn->Close();
101 | }else{
102 | $answer = create_error('The Connection Module was not initialized properly for an unknown reason.');
103 | }
104 |
105 | log_messages("\nAnswer From Database:\n\n\t".@$answer."\n\n\n");
106 | echo $answer;
107 |
108 | echo '';
109 | ?>
110 |
--------------------------------------------------------------------------------
/selectcoursesystem/_mmServerScripts/_notes/dwsync.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/selectcoursesystem/_mmServerScripts/mysql.php:
--------------------------------------------------------------------------------
1 | "Error",
21 | 2 => "Warning",
22 | 4 => "Parsing Error",
23 | 8 => "Notice",
24 | 16 => "Core Error",
25 | 32 => "Core Warning",
26 | 64 => "Compile Error",
27 | 128 => "Compile Warning",
28 | 256 => "User Error",
29 | 512 => "User Warning",
30 | 1024=> "User Notice",
31 | 2048=> "E_ALL",
32 | 2049=> "PHP5 E_STRICT"
33 |
34 | );
35 | $str = sprintf("[%s]\n%s:\t%s\nFile:\t\t'%s'\nLine:\t\t%s\n\n", date('d-m-Y H:i:s'),(isset($errortype[@$errno])?$errortype[@$errno]:('Unknown '.$errno)),@$errstr,@$errfile,@$errline);
36 | if (error_reporting() != 0) {
37 | @fwrite($f, $str);
38 | if (@$errno == 2 && isset($already_sent) && !$already_sent==true){
39 | $error = ''."\n";
40 | $error .= 'An Warning Type error appeared. The error is logged into the log file.'."\n";
41 | $error .= ''."\n";
42 | $already_sent = true;
43 | echo $error;
44 | }
45 | }
46 | }
47 | if ($debug_to_file){
48 | $old_error_handler = set_error_handler("KT_ErrorHandler");
49 | }
50 |
51 | class MySqlConnection
52 | {
53 | /*
54 | // The 'var' keyword is deprecated in PHP5 ... we will define these variables at runtime.
55 | var $isOpen;
56 | var $hostname;
57 | var $database;
58 | var $username;
59 | var $password;
60 | var $timeout;
61 | var $connectionId;
62 | var $error;
63 | */
64 | function MySqlConnection($ConnectionString, $Timeout, $Host, $DB, $UID, $Pwd)
65 | {
66 | $this->isOpen = false;
67 | $this->timeout = $Timeout;
68 | $this->error = '';
69 |
70 | if( $Host ) {
71 | $this->hostname = $Host;
72 | }
73 | elseif( preg_match("/host=([^;]+);/", $ConnectionString, $ret) ) {
74 | $this->hostname = $ret[1];
75 | }
76 |
77 | if( $DB ) {
78 | $this->database = $DB;
79 | }
80 | elseif( preg_match("/db=([^;]+);/", $ConnectionString, $ret) ) {
81 | $this->database = $ret[1];
82 | }
83 |
84 | if( $UID ) {
85 | $this->username = $UID;
86 | }
87 | elseif( preg_match("/uid=([^;]+);/", $ConnectionString, $ret) ) {
88 | $this->username = $ret[1];
89 | }
90 |
91 | if( $Pwd ) {
92 | $this->password = $Pwd;
93 | }
94 | elseif( preg_match("/pwd=([^;]+);/", $ConnectionString, $ret) ) {
95 | $this->password = $ret[1];
96 | }
97 | }
98 |
99 | function Open()
100 | {
101 | $this->connectionId = mysql_connect($this->hostname, $this->username, $this->password);
102 | if (isset($this->connectionId) && $this->connectionId && is_resource($this->connectionId))
103 | {
104 | $this->isOpen = ($this->database == "") ? true : mysql_select_db($this->database, $this->connectionId);
105 | }
106 | else
107 | {
108 | $this->isOpen = false;
109 | }
110 | }
111 |
112 | function TestOpen()
113 | {
114 | return ($this->isOpen) ? '' : $this->HandleException();
115 | }
116 |
117 | function Close()
118 | {
119 | if (is_resource($this->connectionId) && $this->isOpen)
120 | {
121 | if (mysql_close($this->connectionId))
122 | {
123 | $this->isOpen = false;
124 | unset($this->connectionId);
125 | }
126 | }
127 | }
128 |
129 | function GetTables($table_name = '')
130 | {
131 | $xmlOutput = "";
132 | if ($this->isOpen && isset($this->connectionId) && is_resource($this->connectionId)){
133 | // 1. mysql_list_tables and mysql_tablename are deprecated in PHP5
134 | // 2. For backward compatibility GetTables don't have any parameters
135 | if ($table_name === ''){
136 | $table_name = @$_POST['Database'];
137 | }
138 | //added backtick for handling reserved words and special characters
139 | //http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
140 | $sql = ' SHOW TABLES FROM ' . $this->ensureTicks($table_name) ;
141 | $results = mysql_query($sql, $this->connectionId) or $this->HandleException();
142 |
143 | $xmlOutput = "";
144 |
145 | // Columns are referenced by index, so Schema and
146 | // Catalog must be specified even though they are not supported
147 |
148 | $xmlOutput .= 'TABLE_CATALOG'; // column 0 (zero-based)
149 | $xmlOutput .= 'TABLE_SCHEMA'; // column 1
150 | $xmlOutput .= 'TABLE_NAME'; // column 2
151 |
152 | $xmlOutput .= "";
153 |
154 | if (is_resource($results) && mysql_num_rows($results) > 0){
155 | while ($row = mysql_fetch_array($results)){
156 | $xmlOutput .= '' . $row[0]. '
';
157 | }
158 | }
159 | $xmlOutput .= "";
160 |
161 | }
162 | return $xmlOutput;
163 | }
164 |
165 | function GetViews()
166 | {
167 | // not supported
168 | return "";
169 | }
170 |
171 | function GetProcedures()
172 | {
173 | // not supported
174 | return "";
175 | }
176 |
177 | function GetColumnsOfTable($TableName)
178 | {
179 | $xmlOutput = "";
180 | //added backtick for handling reserved words and special characters
181 | //http://dev.mysql.com/doc/refman/5.0/en/legal-names.html
182 | $query = "DESCRIBE ".$this->ensureTicks($TableName);
183 | $result = mysql_query($query) or $this->HandleException();
184 |
185 | if ($result)
186 | {
187 | $xmlOutput = "";
188 |
189 | // Columns are referenced by index, so Schema and
190 | // Catalog must be specified even though they are not supported
191 | $xmlOutput .= "TABLE_CATALOG"; // column 0 (zero-based)
192 | $xmlOutput .= "TABLE_SCHEMA"; // column 1
193 | $xmlOutput .= "TABLE_NAME"; // column 2
194 | $xmlOutput .= "COLUMN_NAME";
195 | $xmlOutput .= "DATA_TYPE";
196 | $xmlOutput .= "IS_NULLABLE";
197 | $xmlOutput .= "COLUMN_SIZE";
198 |
199 | $xmlOutput .= "";
200 |
201 | // The fields returned from DESCRIBE are: Field, Type, Null, Key, Default, Extra
202 | while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
203 | {
204 | $xmlOutput .= "";
205 |
206 | // Separate type from size. Format is: type(size)
207 | if (preg_match("/(.*)\((.*)\)/", $row["Type"], $ret))
208 | {
209 | $type = $ret[1];
210 | $size = $ret[2];
211 | }
212 | else
213 | {
214 | $type = $row["Type"];
215 | $size = "";
216 | }
217 |
218 | // MySQL sets nullable to "YES" or "", so we need to set "NO"
219 | $null = $row["Null"];
220 | if ($null == "")
221 | $null = "NO";
222 |
223 | $xmlOutput .= "" . $row["Field"] . "";
224 | $xmlOutput .= "" . $type . "";
225 | $xmlOutput .= "" . $null . "";
226 | $xmlOutput .= "" . $size . "
";
227 | }
228 | mysql_free_result($result);
229 |
230 | $xmlOutput .= "";
231 | }
232 |
233 | return $xmlOutput;
234 | }
235 |
236 | function GetParametersOfProcedure($ProcedureName, $SchemaName, $CatalogName)
237 | {
238 | // not supported on MySQL
239 | return '';
240 | }
241 |
242 | function ExecuteSQL($aStatement, $MaxRows)
243 | {
244 | if ( get_magic_quotes_gpc() )
245 | {
246 | $aStatement = stripslashes( $aStatement ) ;
247 | }
248 |
249 | $xmlOutput = "";
250 |
251 | $result = mysql_query($aStatement) or $this->HandleException();
252 |
253 | if (isset($result) && is_resource($result))
254 | {
255 | $xmlOutput = "";
256 |
257 | $fieldCount = mysql_num_fields($result);
258 | for ($i=0; $i < $fieldCount; $i++)
259 | {
260 | $meta = mysql_fetch_field($result);
261 | if ($meta)
262 | {
263 | $xmlOutput .= 'type;
265 | $xmlOutput .= '" max_length="' . $meta->max_length;
266 | $xmlOutput .= '" table="' . $meta->table;
267 | $xmlOutput .= '" not_null="' . $meta->not_null;
268 | $xmlOutput .= '" numeric="' . $meta->numeric;
269 | $xmlOutput .= '" unsigned="' . $meta->unsigned;
270 | $xmlOutput .= '" zerofill="' . $meta->zerofill;
271 | $xmlOutput .= '" primary_key="' . $meta->primary_key;
272 | $xmlOutput .= '" multiple_key="'. $meta->multiple_key;
273 | $xmlOutput .= '" unique_key="' . $meta->unique_key;
274 | $xmlOutput .= '">' . $meta->name;
275 | $xmlOutput .= '';
276 | }
277 | }
278 |
279 | $xmlOutput .= "";
280 | $row = mysql_fetch_assoc($result);
281 |
282 | for ($i=0; $row && ($i < $MaxRows); $i++)
283 | {
284 | $xmlOutput .= "";
285 |
286 | foreach ($row as $key => $value)
287 | {
288 | $xmlOutput .= "";
289 | $xmlOutput .= htmlspecialchars($value);
290 | $xmlOutput .= "";
291 | }
292 |
293 | $xmlOutput .= "
";
294 | $row = mysql_fetch_assoc($result);
295 | }
296 |
297 | mysql_free_result($result);
298 |
299 | $xmlOutput .= "";
300 | }
301 |
302 | return $xmlOutput;
303 | }
304 |
305 | function GetProviderTypes()
306 | {
307 | return '';
308 | }
309 |
310 | function ExecuteSP($aProcStatement, $TimeOut, $Parameters)
311 | {
312 | return '';
313 | }
314 |
315 | function ReturnsResultSet($ProcedureName)
316 | {
317 | return '';
318 | }
319 |
320 | function SupportsProcedure()
321 | {
322 | return '';
323 | }
324 |
325 | /*
326 | * HandleException added by InterAKT for ease in database translation answer
327 | */
328 | function HandleException()
329 | {
330 | global $debug_to_file, $f;
331 | $this->error = create_error(' MySQL Error#: '. ((int)mysql_errno()) . "\n\n".mysql_error());
332 | log_messages($this->error);
333 | die($this->error.'