程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 基於Sql Server 2008的分布式數據庫的實踐(五)

基於Sql Server 2008的分布式數據庫的實踐(五)

編輯:關於PHP編程

程序設計

-----------------------------------------------------------------------------------------------------------------

Index.php————選擇界面,並且實現學生和老師的注冊

sql_ini.php————SQL配置文件

./student————學生的後台

./admin————老師的後台

-----------------------------------------------------------------------------------------------------------------

./student

cookie.php————cookie轉跳文件

index1.php————後台界面

login.php————登錄界面

loginout.php————cookie注銷處理

main.php————主界面

menu.php————後台菜單

sclass.php————顯示學生選課信息

score.php-————顯示學生成績

sinfo.php————顯示學生資料

sql_ini.php————SQL配置文件

up.php————後台表單處理文件

-----------------------------------------------------------------------------------------------------------------

./admin

class.php————顯示老師課程信息

cookie.php————cookie轉跳文件

index1.php————後台界面

info.php————顯示老師資料(有權限設置)

login.php————登錄界面

loginout.php————cookie注銷處理

main.php————主界面

menu.php————後台菜單

score.php-————登記學生成績

sql_ini.php————SQL配置文件

up.php————後台表單處理文件

程序解釋

學生注冊

 ((['addstudent'      
     ((['sname']=='')||(['sex']=='')||(['school']=='')||(['scount']=='')||(['spwd1']=='')||(['spwd2']==''           '請輸全信息!'               
     =['sname'     =['sex'     =['school'     =['scount'     =['spwd1'     =['spwd2'     =(1,9999); 
     (==          
          
         ="select * from [V3].[dbo].[V3_student]"          = mssql_query(         
          ( = mssql_fetch_array(,              
             (['scount']==                  
                  ("已經有人申請了這個帳號!"                            
         ="                         VALUES ("..",'".."','".."','".."','".."','".."')"          = mssql_query(         
         (             { "<center>注冊成功!</center>"          
             { "sql出錯!"      
          
          ("兩次密碼不對"           }

 

老師注冊

 ((['addadmin'      
     ((['name']=='')||(['sex']=='')||(['age']=='')||(['count']=='')||(['pwd']=='')||(['pwd2']=='')||(['ageage']=='')||(['tel']=='')||(['address']==''           '請輸全信息!'               
     =['name'     =['sex'     =['age'     =['count'     =['pwd'     =['pwd2'     =['ageage'     =['tel'     =['address'     =1     =(1,9999     
     (==          
          
         ="select * from [V3].[dbo].[teacher]"          = mssql_query(         
          ( = mssql_fetch_array(,              
             (['tcount']==                  
                  ("已經有人申請了這個帳號!"                            ="EXEC [V3].[dbo].[V3_teacher] "..",'".."', '".."', '".."', '".."', '".."', '".."','".."','".."','".."'"          = mssql_query(         (             { "<center>注冊成功!</center>"          
             { "sql出錯!"      
          
          ("兩次密碼不對"           }

學生登錄和查看資料

 
     =['uid'      
      = "SELECT * FROM [V3].[dbo].[V3_student] where [sid]="..""      = mssql_query(     
     =mssql_num_fields(     
     [0]='學號'     [1]='姓名'     [2]='學院'     [3]='帳號'     [4]='密碼'       
      "<table border='1' >\n"      "\t<tr>\n"     (=0;<;++          
          "\t\t<td>".[]."</td>\n"       "\t</tr>\n"      ( = mssql_fetch_array(,          
        "\t<tr>\n"              '<td>'.["sid"].'</td>'              '<td>'.["sname"].'</td>'              '<td>'.["school"].'</td>'              '<td>'.["scount"].'</td>'              '<td>******</td>';
          "\t</tr>\n"       "</table>\n"     
     mssql_free_result();

學生選課

 
 (['action']=='do'      
     =["uid"      
     ="SELECT * FROM [V3].[dbo].[class] where [sid]="..""      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['cid'         ++      
     
     ="SELECT * FROM [V3].[dbo].[class] where [sid] = 0"      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['tid'         []=['cid'         []=['cname'         ++      
     (=0;<;++          []="SELECT * FROM [V3].[dbo].[teacher] where [tid]=".[].""         []= mssql_query([          ( = mssql_fetch_array([],              []=['tsex'             []=['tage'             []=['tname'       
     [0]='課號'     [1]='課名'     [2]='老師名字'     [3]='老師編號'     [4]='老師教學年齡'     [5]='老師性別'     [6]='選課'       
      '<form action="up.php" method="POST">'      "<table border='1' >\n"      "\t<tr><td colspan='7' align='center'>選課系統</td></tr>\n"      "\t<tr>\n"      "\t<tr>\n"     
     (=0;<7;++           "\t\t<td>".[]."</td>\n"      (=0;<;++          
          = ''         
         ([]=='0'                 []='男'         
                 []='女'         
         (=0;<;++              ([]==[                   = 'checked'            "\t<tr>\n"              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td><input type="checkbox" name=pa_'.[].' '..'></td>';
          "\t</tr>\n"       "\t<tr><td colspan='7' align='center'><input type='submit' name='sub' value='確認課程'></td></tr>\n"      "</table>\n"      "</form>" }

 

學生退課

 
 (['action']=='mine'      
     =["uid"      
     ="SELECT * FROM [V3].[dbo].[class] where [sid]="..""      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['cid'         []=['cname'         []=['tid'         ++      
     (=0;<;++          []="SELECT * from [V3].[dbo].[teacher] where [tid]=".[].""         [] = mssql_query([          ( = mssql_fetch_array([],              []=['tsex'             []=['tage'             []=['tname'       
     [0]='課號'     [1]='課名'     [2]='老師名字'     [3]='老師編號'     [4]='老師教學年齡'     [5]='老師性別'     [6]='退課'       
      '<form action="up.php" method="POST">'      "<table border='1' >\n"      "\t<tr><td colspan='7' align='center'>我選上的課</td></tr>\n"      "\t<tr>\n"      "\t<tr>\n"     
     (=0;<7;++           "\t\t<td>".[]."</td>\n"       "\t</tr>\n"     (=0;<;++          
         ([]=='0'                 []='男'         
                 []='女'          "\t<tr>\n"              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td><input type="checkbox" name="ma_'.[].'" ></td></td>'          "\t</tr>\n"       "\t<tr><td colspan='7' align='center'><input type='submit' name='delsub' value='確認退課'></td></tr>\n"      "</table>\n"      "</form>" }

學生查看成績

 
     =['uid'      
     ="SELECT * FROM [V3].[dbo].[class] where [sid]="..""      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['cid'         []=['cname'         []=['tid'         []=['score'         ++      
     (=0;<;++          []="SELECT * from [V3].[dbo].[teacher] where [tid]=".[].""         [] = mssql_query([          ( = mssql_fetch_array([],              []=['tsex'             []=['tage'             []=['tname'       
     [0]='課號'     [1]='課名'     [2]='老師名字'     [3]='老師編號'     [4]='老師教學年齡'     [5]='老師性別'     [6]='分數'           
      "<table border='1' >\n"      "\t<tr><td colspan='7' align='center'>我選上的課</td></tr>\n"      "\t<tr>\n"      "\t<tr>\n"     
     (=0;<7;++           "\t\t<td>".[]."</td>\n"       "\t</tr>\n"     (=0;<;++          ([]=='0'                 []='男'         
                 []='女'         
         ([]=='999'              []='未上成績'           "\t<tr>\n"              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'             
          "\t</tr>\n"       "</table>\n";

老師登錄和查看所有資料(權限限制)

 
 (['people']=='all'      (["super"]=='10'           
          = "SELECT * FROM [V3].[dbo].[teacher]"          = mssql_query(     
           
          "<table border='1' >\n"         
         =mssql_num_fields(         
         [0]='編號'         [1]='姓名'         [2]='教學年齡'         [3]='性別'         [4]='登錄帳號'         [5]='登錄密碼'         [6]='管理權限'         
          "\t<tr>\n"         (=0;<;++               "\t\t<td>".[]."</td>\n"           "\t</tr>\n"         
          ( = mssql_fetch_array(,              
             (["tsex"]=='0'                 ["tsex"]='男'             
                 ["tsex"]='女'             
             (["tsuper"]=='10'                 ["tsuper"]='超級老師管理員'             
                 ["tsuper"]='普通老師管理員'             
                 
              "\t<tr>\n"                      '<td>'.["tid"].'</td>'                      '<td>'.["tname"].'</td>'                      '<td>'.["tage"].'</td>'                      '<td>'.["tsex"].'</td>'                      '<td>'.["tcount"].'</td>'                      '<td>******</td>';
                      '<td>'.["tsuper"].'</td>'              "\t</tr>\n"           "</table>\n"         
         
         mssql_free_result(      
           "沒有權限查看!"  }

老師查看資料

 
 (['people']=='me'      
     =["uid"     
      = "SELECT * FROM [V3].[dbo].[teacher] where tid="..""      = mssql_query(       
      "<table border='1' >\n"     
     =mssql_num_fields(     
     [0]='編號'     [1]='姓名'     [2]='教學年齡'     [3]='性別'     [4]='登錄帳號'     [5]='登錄密碼'     [6]='管理權限'     
      "\t<tr>\n"     (=0;<;++           "\t\t<td>".[]."</td>\n"       "\t</tr>\n"      ( = mssql_fetch_array(,          
         (["tsex"]=='0'                 ["tsex"]='男'             
                 ["tsex"]='女'             
             (["tsuper"]=='10'                 ["tsuper"]='超級老師管理員'             
                 ["tsuper"]='普通老師管理員'             
                 
              "\t<tr>\n"                      '<td>'.["tid"].'</td>'                      '<td>'.["tname"].'</td>'                      '<td>'.["tage"].'</td>'                      '<td>'.["tsex"].'</td>'                      '<td>'.["tcount"].'</td>'                      '<td>******</td>';
                      '<td>'.["tsuper"].'</td>'              "\t</tr>\n"       "</table>\n"     
     
         mssql_free_result( }

老師添加老師(權限限制)

 
 ((['addsub'      
     =['name'     =['sex'     =['age'     =['count'     =['pwd'     =['pwd2'     =['super'     =['idid'     =['ageage'     =['tel'     =['address'     
     (==           
         ="select * from [V3].[dbo].[teacher]"          = mssql_query(         
          ( = mssql_fetch_array(,              
             (['tcount']==                  
                  ("已經有人申請了這個帳號!"                            
         ="EXEC [V3].[dbo].[V3_teacher] "..",'".."', '".."', '".."', '".."', '".."', '".."','".."','".."','".."'"          = mssql_query(         (             { "添加成功!"          
             { "sql出錯!"      
          
          ("兩次密碼不對"           }

老師刪減老師(權限限制)

 
 ((['delsub'       =['id'     ="DELETE FROM [V3].[dbo].[teacher] where [tid]="..""      = mssql_query(     (         { "刪除成功"     
         { "SQL出錯!" }

老師添加課程

 
 ((['addclass'       
     =['id'     =['name'     
     ="INSERT INTO [V3].[dbo].[class] ([sid], [tid], [cname],[score],[cid]) VALUES (0, "..", '".."',999,".(1,999).")"      = mssql_query(     (         { "創建課程成功"     
         { "SQL出錯!" }

老師查看選課情況

 

 (['action']=='list'      
     =["uid"      
     ="SELECT * FROM [V3].[dbo].[class] where [tid]=".." AND [sid] = 0"      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['cid'         []=['cname'         ++      
     (=0;<;++          []="SELECT * FROM [V3].[dbo].[class] where [tid]=".." AND [cid] = ".[].""         []= mssql_query([         []=mssql_num_rows([      
     [0]='課號'     [1]='課名'     [2]='選課人數'           
      "<table border='1' >\n"      "\t<tr><td colspan='3' align='center'>老師號:".."</td></tr>\n"      "\t<tr>\n"     
     (=0;<3;++           "\t\t<td>".[]."</td>\n"       "\t</tr>\n"     (=0;<;++          
         []=[]-1          "\t<tr>\n"              '<td>'.[].'</td>'              '<td>'.[].'</td>'              '<td>'.[].'</td>'          "\t</tr>\n"       "</table>\n"  ?>

老師刪減課程

 
 ((['delclass'       
     =['cid'     
     ="DELETE FROM [V3].[dbo].[class] where [cid]="..""      = mssql_query(     (         { "刪除課程成功"     
         { "SQL出錯!";}

老師查看成績

 
 (['action']=='show'       
     =["uid"     
     ="SELECT * FROM [V3].[dbo].[class] where [sid]=0 AND [tid] = "..""      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['cid'         []=['cname'         ++      
     (=0;<;++          
         ="SELECT * FROM [V3].[dbo].[class] where [cid]=".[]." AND [tid] = "..""          = mssql_query(         =0;
         ( = mssql_fetch_array(,              [][]=['sid'             [][]=['score'             ++          []=;
      
     (=0;<;++          (=0;<[];++              
             ="SELECT * FROM [V3].[dbo].[V3_student] where [sid]=".[][].""              = mssql_query(             ( = mssql_fetch_array(,                  [][]=['sname'        
     (['cid']=='0'          (=0;<;++                       "<a href='score.php?action=show&cid=".[]."'>查看__".[]."__課程情況!</a><br>"       (=0;<;++          (['cid']==[              
             [0]='課號'             [1]='課名'             [2]='學生號'             [3]='學生名'             [4]='成績'               
              "<table border='1' >\n"              "\t<tr>\n"             
             (=0;<5;++                   "\t\t<td>".[]."</td>\n"               "\t</tr>\n"             
                 (=0; < [  ];++                      ([][]=="999"                          [][]="未上傳成績"                      ([][]=='0'                          
                                               
                      "\t<tr>\n"                          '<td>'.[].'</td>'                          '<td>'.[].'</td>'                          '<td>'.[][].'</td>'                          '<td>'.[][].'</td>'                          '<td>'.[][].'</td>'                      "\t</tr>\n"               "</table>\n"   }

老師上傳成績

 ((['up'       
     =["uid"     
     =['cid'     
     ="SELECT * FROM [V3].[dbo].[class] where [cid]=".." AND [tid] = "..""      = mssql_query(     =0;
      ( = mssql_fetch_array(,          []=['score'         []=['sid'         ++      (=0;<;++          ([]=='0'              
                       
         ((["sid_[]"              
             (["sid_[]"]<=100&&["sid_[]"]>=0                  
                 []=["sid_[]"              
             { "輸入0~100之內的數字成績!<br>"          
         { "輸入數字!<br>"         
         ="UPDATE [V3].[dbo].[class] SET [score] = ".[]." WHERE [cid] =".." AND [sid] =".[].""          = mssql_query(         (         { "上傳成績成功!"         
         { "上傳失敗!"  }

 

 

轉載請注明出處:http://www.cnblogs.com/yydcdut/p/3461254.html

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved