2016-09-17 93 views
-5

我怎麼可以連接數據庫通過使用此代碼,我如何登錄學生和重定向到學生面板請寫下 PHP登錄代碼如何我可以連接和登錄在PHP本地主機在PHP使用此代碼

body { 
 
\t background: #DCDDDF url(http://cssdeck.com/uploads/media/items/7/7AF2Qzt.png); 
 
\t color: #000; 
 
\t font: 14px Arial; 
 
\t margin: 0 auto; 
 
\t padding: 0; 
 
\t position: relative; 
 
} 
 
h1{ font-size:28px;} 
 
h2{ font-size:26px;} 
 
h3{ font-size:18px;} 
 
h4{ font-size:16px;} 
 
h5{ font-size:14px;} 
 
h6{ font-size:12px;} 
 
h1,h2,h3,h4,h5,h6{ color:#563D64;} 
 
small{ font-size:10px;} 
 
b, strong{ font-weight:bold;} 
 
a{ text-decoration: none; } 
 
a:hover{ text-decoration: underline; } 
 
.left { float:left; } 
 
.right { float:right; } 
 
.alignleft { float: left; margin-right: 15px; } 
 
.alignright { float: right; margin-left: 15px; } 
 
.clearfix:after, 
 
form:after { 
 
\t content: "."; 
 
\t display: block; 
 
\t height: 0; 
 
\t clear: both; 
 
\t visibility: hidden; 
 
} 
 
.container { margin: 25px auto; position: relative; width: 900px; } 
 
#content { 
 
\t background: #f9f9f9; 
 
\t background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%); 
 
\t background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0); 
 
\t -webkit-box-shadow: 0 1px 0 #fff inset; 
 
\t -moz-box-shadow: 0 1px 0 #fff inset; 
 
\t -ms-box-shadow: 0 1px 0 #fff inset; 
 
\t -o-box-shadow: 0 1px 0 #fff inset; 
 
\t box-shadow: 0 1px 0 #fff inset; 
 
\t border: 1px solid #c4c6ca; 
 
\t margin: 0 auto; 
 
\t padding: 25px 0 0; 
 
\t position: relative; 
 
\t text-align: center; 
 
\t text-shadow: 0 1px 0 #fff; 
 
\t width: 400px; 
 
} 
 
#content h1 { 
 
\t color: #7E7E7E; 
 
\t font: bold 25px Helvetica, Arial, sans-serif; 
 
\t letter-spacing: -0.05em; 
 
\t line-height: 20px; 
 
\t margin: 10px 0 30px; 
 
} 
 
#content h1:before, 
 
#content h1:after { 
 
\t content: ""; 
 
\t height: 1px; 
 
\t position: absolute; 
 
\t top: 10px; 
 
\t width: 27%; 
 
} 
 
#content h1:after { 
 
\t background: rgb(126,126,126); 
 
\t background: -moz-linear-gradient(left, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%); 
 
\t background: -webkit-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: -o-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: -ms-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
    right: 0; 
 
} 
 
#content h1:before { 
 
\t background: rgb(126,126,126); 
 
\t background: -moz-linear-gradient(right, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%); 
 
\t background: -webkit-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: -o-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: -ms-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
\t background: linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); 
 
    left: 0; 
 
} 
 
#content:after, 
 
#content:before { 
 
\t background: #f9f9f9; 
 
\t background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%); 
 
\t background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); 
 
\t filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0); 
 
\t border: 1px solid #c4c6ca; 
 
\t content: ""; 
 
\t display: block; 
 
\t height: 100%; 
 
\t left: -1px; 
 
\t position: absolute; 
 
\t width: 100%; 
 
} 
 
#content:after { 
 
\t -webkit-transform: rotate(2deg); 
 
\t -moz-transform: rotate(2deg); 
 
\t -ms-transform: rotate(2deg); 
 
\t -o-transform: rotate(2deg); 
 
\t transform: rotate(2deg); 
 
\t top: 0; 
 
\t z-index: -1; 
 
} 
 
#content:before { 
 
\t -webkit-transform: rotate(-3deg); 
 
\t -moz-transform: rotate(-3deg); 
 
\t -ms-transform: rotate(-3deg); 
 
\t -o-transform: rotate(-3deg); 
 
\t transform: rotate(-3deg); 
 
\t top: 0; 
 
\t z-index: -2; 
 
} 
 
#content form { margin: 0 20px; position: relative } 
 
#content form input[type="text"], 
 
#content form input[type="password"] { 
 
\t -webkit-border-radius: 3px; 
 
\t -moz-border-radius: 3px; 
 
\t -ms-border-radius: 3px; 
 
\t -o-border-radius: 3px; 
 
\t border-radius: 3px; 
 
\t -webkit-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset; 
 
\t -moz-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset; 
 
\t -ms-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset; 
 
\t -o-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset; 
 
\t box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset; 
 
\t -webkit-transition: all 0.5s ease; 
 
\t -moz-transition: all 0.5s ease; 
 
\t -ms-transition: all 0.5s ease; 
 
\t -o-transition: all 0.5s ease; 
 
\t transition: all 0.5s ease; 
 
\t background: #eae7e7 url(http://cssdeck.com/uploads/media/items/8/8bcLQqF.png) no-repeat; 
 
\t border: 1px solid #c8c8c8; 
 
\t color: #777; 
 
\t font: 13px Helvetica, Arial, sans-serif; 
 
\t margin: 0 0 10px; 
 
\t padding: 15px 10px 15px 40px; 
 
\t width: 80%; 
 
} 
 
#content form input[type="text"]:focus, 
 
#content form input[type="password"]:focus { 
 
\t -webkit-box-shadow: 0 0 2px #ed1c24 inset; 
 
\t -moz-box-shadow: 0 0 2px #ed1c24 inset; 
 
\t -ms-box-shadow: 0 0 2px #ed1c24 inset; 
 
\t -o-box-shadow: 0 0 2px #ed1c24 inset; 
 
\t box-shadow: 0 0 2px #ed1c24 inset; 
 
\t background-color: #fff; 
 
\t border: 1px solid #ed1c24; 
 
\t outline: none; 
 
} 
 
#username { background-position: 10px 10px !important } 
 
#password { background-position: 10px -53px !important } 
 
#content form input[type="submit"] { 
 
\t background: rgb(254,231,154); 
 
\t background: -moz-linear-gradient(top, rgba(254,231,154,1) 0%, rgba(254,193,81,1) 100%); 
 
\t background: -webkit-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%); 
 
\t background: -o-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%); 
 
\t background: -ms-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%); 
 
\t background: linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%); 
 
\t filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fee79a', endColorstr='#fec151',GradientType=0); 
 
\t -webkit-border-radius: 30px; 
 
\t -moz-border-radius: 30px; 
 
\t -ms-border-radius: 30px; 
 
\t -o-border-radius: 30px; 
 
\t border-radius: 30px; 
 
\t -webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset; 
 
\t -moz-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset; 
 
\t -ms-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset; 
 
\t -o-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset; 
 
\t box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset; 
 
\t border: 1px solid #D69E31; 
 
\t color: #85592e; 
 
\t cursor: pointer; 
 
\t float: left; 
 
\t font: bold 15px Helvetica, Arial, sans-serif; 
 
\t height: 35px; 
 
\t margin: 20px 0 35px 15px; 
 
\t position: relative; 
 
\t text-shadow: 0 1px 0 rgba(255,255,255,0.5); 
 
\t width: 120px; 
 
} 
 
#content form input[type="submit"]:hover { 
 
\t background: rgb(254,193,81); 
 
\t background: -moz-linear-gradient(top, rgba(254,193,81,1) 0%, rgba(254,231,154,1) 100%); 
 
\t background: -webkit-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%); 
 
\t background: -o-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%); 
 
\t background: -ms-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%); 
 
\t background: linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%); 
 
\t filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fec151', endColorstr='#fee79a',GradientType=0); 
 
} 
 
#content form div a { 
 
\t color: #004a80; 
 
    float: right; 
 
    font-size: 12px; 
 
    margin: 30px 15px 0 0; 
 
    text-decoration: underline; 
 
} 
 
.button { 
 
\t background: rgb(247,249,250); 
 
\t background: -moz-linear-gradient(top, rgba(247,249,250,1) 0%, rgba(240,240,240,1) 100%); 
 
\t background: -webkit-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%); 
 
\t background: -o-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%); 
 
\t background: -ms-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%); 
 
\t background: linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%); 
 
\t filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f9fa', endColorstr='#f0f0f0',GradientType=0); 
 
\t -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset; 
 
\t -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset; 
 
\t -ms-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset; 
 
\t -o-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset; 
 
\t box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset; 
 
\t -webkit-border-radius: 0 0 5px 5px; 
 
\t -moz-border-radius: 0 0 5px 5px; 
 
\t -o-border-radius: 0 0 5px 5px; 
 
\t -ms-border-radius: 0 0 5px 5px; 
 
\t border-radius: 0 0 5px 5px; 
 
\t border-top: 1px solid #CFD5D9; 
 
\t padding: 15px 0; 
 
} 
 
.button a { 
 
\t background: url(http://cssdeck.com/uploads/media/items/8/8bcLQqF.png) 0 -112px no-repeat; 
 
\t color: #7E7E7E; 
 
\t font-size: 17px; 
 
\t padding: 2px 0 2px 40px; 
 
\t text-decoration: none; 
 
\t -webkit-transition: all 0.3s ease; 
 
\t -moz-transition: all 0.3s ease; 
 
\t -ms-transition: all 0.3s ease; 
 
\t -o-transition: all 0.3s ease; 
 
\t transition: all 0.3s ease; 
 
} 
 
.button a:hover { 
 
\t background-position: 0 -135px; 
 
\t color: #00aeef; 
 
}
<!DOCTYPE html> 
 
<html > 
 
    <head> 
 
    <meta charset="UTF-8"> 
 
    <title>Online Student Service Center</title> 
 
    
 
     <link rel="stylesheet" href="style.css"> 
 
    
 
    </head> 
 

 
    <body> 
 

 
    <body> 
 
<div class="container"> 
 
\t <section id="content"> 
 
\t \t <form action="php/login.php" method="POST" > 
 
\t \t \t <h1>Login Form</h1> 
 
\t \t \t <div> 
 
\t \t \t \t <input type="text" placeholder="Student ID" required="" id="username" /> 
 
\t \t \t </div> 
 
\t \t \t <div> 
 
\t \t \t \t <input type="password" placeholder="Password" required="" id="password" /> 
 
\t \t \t </div> 
 
\t \t \t <div> 
 
\t \t \t \t <input type="submit" value="Log in" /> 
 
\t \t \t \t <a href="#">Lost your password?</a> 
 
\t \t \t \t <a href="#">Register</a> 
 
\t \t \t </div> 
 
\t \t </form><!-- form --> 
 
\t \t <div class="button"> 
 
\t \t \t <a href="admin.html">Admin</a> 
 
\t \t </div><!-- button --> 
 
    
 
<div class="button"> 
 
<a href="teacher.html">Teacher</a> 
 
</div><!-- button --> 
 

 
\t </section><!-- content --> 
 
</div><!-- container --> 
 
</body> 
 

 
    </body> 
 
</html>

也請您告訴我,我怎麼可以從數據庫

+2

歡迎堆棧溢出。請檢查這個[鏈接](http://stackoverflow.com/help/how-to-ask) –

+0

請記住,SO是爲了調試,而不是爲您編寫代碼的服務。 –

+0

okayhttp://stackoverflow.com/users/6773269/patrick-mlr –

回答

0

獲取數據你一定CSS和HTML。您無法連接數據庫和這些信息。我的建議是,嘗試創建自己的數據庫並嘗試在本地主機上連接數據庫。 Y

您必須知道數據庫登錄信息。 Here是php數據庫連接課程。

+0

請你可以發送給我的用戶登錄的PHP代碼 –

0

對於登錄

步驟。>

1,創建數據庫

2.連接到數據庫

3.Gather發佈數據到變量

4.使用數據庫檢查發佈的變量

5.Login成功的

借鑑here

+0

我試過這個鏈接,但它不工作 –

相關問題