-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
77 lines (75 loc) · 2.18 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start();
if($_SESSION['username']) {
header("location:".'/imcase/selectuser.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>websocket demo</title>
<meta charset="UTF-8">
<style>
.main {
text-align: center;
margin-top: 12%;
}
.step2 {
display: none;
margin-top: 20px;
}
.message {
display: none;
width: 268px;
text-align: left;
margin: 0 auto;
height: 297px;
overflow: auto;
padding-left: 10px;
padding-right: 10px;
background: blanchedalmond;
}
</style>
</head>
<body>
<div class='main'>
<div class="step1">
这是一个简易的 即时通信demo (IM 使用 php mysql swoole 的 websocket redis 实现)
</p>
(一个账号多客户端 可对聊 多用户多客户端)<p>
现有的5个测试账号(同一客户端,选一个进行登录):<p>
test1, test2, test3, test4, test5<p>
密码都是 :123456
</div>
<div class="step1">
<form id="loginfrom">
账号:<input type="text" class="lg" name="username" value="test1">
密码:<input type="text" class="lg" name="password" value="123456">
<input type="submit" value="登录">
</form>
</div>
</div>
</body>
</html>
<script src='layer/jquery-1.9.1.min.js'></script>
<script src="layer/layer.js"></script>
<script>
$('#loginfrom').submit(function () {
var data = getFormdata('.lg');
if(!data.username || !data.password){
layer.msg('填写账号密码', {icon:2});
}
parent.layer.load();
$.post('dologin.php',data,function (data) {
parent.layer.closeAll('loading');
if(data.status) {
layer.msg(data.info, {icon:1});
$('.lg').val('');
window.location.href = 'selectuser.php';
} else {
layer.msg(data.info, {icon:2});
}
},'json');
return false;
})
</script>