Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
站登陸是很常用的功能,如果你希望進行用戶管理,對不同用戶區別顯示不同內容,那么就必然使用用戶登陸功能。
python開發的網站實現用戶登陸非常簡單,尤其是使用flask的開發。
本例是用flask實現的一個簡單實例:用最簡單的代碼實現網站登陸的基本功能。文末附源碼下載方法,你可以進一步修改實現自己需要的各種功能。
本例中:同樣的一個頁面,如果未登陸的用訪問顯示的是花花草草圖片,頁面下方顯示登陸對話框。但是用戶登陸狀態下訪問同樣的頁面見到的是美女圖片,下方的登陸對話框也變成了登出按鈕。
本例代碼簡單,python代碼40行左右實現了全部功能,基于這樣的模式,你可以進一步修改實現各種需要的功能,例如開發一個公司主頁,讓未登錄的訪客只能看到對外宣傳文檔,一旦用戶登陸為員工則提供內部文件和消息顯示。 如此等等... ...
完整的演示代碼,包括目錄結構和html文件模板打包,已經上傳在百度盤。請加關注后用私信發送"20180303"字樣,系統會自動在私信中回復您下載地址。
請及時關注頭條號“有只狗狗叫多多”,后續將介紹python更多參考代碼,稍做修改即能使用,學習python不要錯過哦。。。。
個登錄界面可能有一點點。。。[黑線]
源碼放著了,要自己拿去吧[奸笑]
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
background-color: #000;
color: #fff;
text-align: center;
padding-top: 100px;
font-family: 'Courier New', Courier, monospace;
}
h1 {
font-size: 50px;
margin-bottom: 30px;
color: #ff0000;
text-shadow: 0 0 10px #ff0000;
}
table {
margin: 0 auto;
width: 400px;
}
th,
td {
padding: 10px;
}
input[type="text"],
input[type="date"] {
width: 300px;
padding: 5px;
border-radius: 5px;
border: 1px solid #ff0000;
background-color: #000;
color: #ff0000;
}
input[type="submit"] {
margin-top: 20px;
padding: 10px;
background-color: #ff0000;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
animation: pulseEffect 1s infinite;
}
input[type="submit"]:hover {
background-color: #ff6666;
animation: none;
}
.success-message {
margin-top: 30px;
display: none;
animation: fadeInEffect 2s;
}
.checkbox-option {
margin-top: 20px;
animation: slideInEffect 2s;
}
.contact-info {
margin-top: 40px;
animation: bounceEffect 1.5s infinite;
}
/* Animations */
@keyframes pulseEffect {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
@keyframes fadeInEffect {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideInEffect {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
@keyframes bounceEffect {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
}
</style>
<script>
window.onload=function () {
document.querySelector('form').addEventListener('submit', function (event) {
event.preventDefault();
var successMessage=document.getElementById('successMessage');
successMessage.style.display='block';
successMessage.style.animation='fadeInEffect 2s forwards';
var submitButton=document.getElementById('submitButton');
submitButton.disabled=true;
});
document.getElementById('closeButton').addEventListener('click', function () {
var successMessage=document.getElementById('successMessage');
successMessage.style.display='none';
});
}
</script>
</head>
<body>
<h1>死亡協議</h1>
<form>
<table>
<tr>
<th>受害者姓名</th>
<td><input type="text"></td>
</tr>
<tr>
<th>身份證號碼</th>
<td><input type="text"></td>
</tr>
<tr>
<th>iphone</th>
<td><input type="text"></td>
</tr>
<tr>
<th>郵箱</th>
<td><input type="text"></td>
</tr>
<tr>
<th>預定日期</th>
<td><input type="date"></td>
</tr>
</table>
<input id="submitButton" type="submit" value="簽署協議">
</form>
<div id="successMessage" class="success-message">
<p>最近自殺人數較多,可能會延期</p>
<button id="closeButton">關閉</button>
</div>
<div class="checkbox-option">
<input type="checkbox" id="agreementCheckbox">
<label for="agreementCheckbox">我同意所有要求</label>
</div>
<div class="contact-info">
<p>客服:LHTZ173@163.com</p>
</div>
</body>
效果圖
*請認真填寫需求信息,我們會在24小時內與您取得聯系。