-
Notifications
You must be signed in to change notification settings - Fork 0
/
connect.php
209 lines (179 loc) · 6.99 KB
/
connect.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!-- 設定網頁編碼為UTF-8 -->
<?php session_start(); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>電子展冊系統</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font awesome icon -->
<link href="css/font-awesome.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/signin.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Scrolling Nav JavaScript -->
<script src="js/jquery.easing.min.js"></script>
<script src="js/scrolling-nav.js"></script>
<link href="css/jquery-ui.css" rel="stylesheet">
<script src="js/jquery-ui.min.js"></script>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">網程專案</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">Electronic Exhibition System</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><p class="navbar-text">電子展冊系統-超級後台</p></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><b>Login</b> <span class="caret"></span></a>
<ul id="login-dp" class="dropdown-menu">
<li>
<div class="row">
<div class="col-md-12">
<form class="form" role="form" method="post" action="connect.php" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="exampleInputEmail2">Email address</label>
<input type="email" class="form-control" name="email" id="exampleInputEmail2" placeholder="Email" required>
</div>
<div class="form-group">
<label class="sr-only" for="exampleInputPassword2">Password</label>
<input type="password" class="form-control" name="pw" id="exampleInputPassword2" placeholder="Password" required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">#</button>
</div>
<!--<div class="checkbox">
<label>
<input type="checkbox"> 保持登入
</label>
</div>-->
</form>
</div>
<div class="bottom text-center">
還沒有帳號嗎 ? <a href="register.php"><b>註冊帳號</b></a>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<script>
</script>
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<!-- Intro Section -->
<section id="intro" class="intro-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Wellcome</h1>
<?php
//連接資料庫
//只要此頁面上有用到連接MySQL就要include它
include("mysql_connect.inc.php");
$email = $_POST['email'];
$pw = $_POST['pw'];
//搜尋資料庫資料
$sql = "SELECT * FROM account where email = '$email'";
$result = mysql_query($sql);
$row = @mysql_fetch_row($result);
//判斷帳號與密碼是否為空白
//以及MySQL資料庫裡是否有這個會員
if($email != null && $pw != null && $row[1] == $email && $row[2] == $pw)
{
$sql = "SELECT * FROM exhibition where organizer_id = '$row[0]'";
$result = mysql_query($sql);
$ex_row = @mysql_fetch_row($result);
$sql = "SELECT * FROM booth where holderId = '$row[0]'";
$result = mysql_query($sql);
$h_row = @mysql_fetch_row($result);
if($ex_row||$h_row){
//將帳號寫入session,方便驗證使用者身份
$_SESSION['email'] = $email;
$_SESSION['accountId'] = $row[0];
//登入成功
echo '<script>
$(function() {
$( "#dialog2" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>';
echo '<meta http-equiv=REFRESH CONTENT=1;url=index.php>';
}
else{//登入失敗 一般用戶
echo '<script>
$(function() {
$( "#dialog3" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>';
echo '<meta http-equiv=REFRESH CONTENT=2;url=login.php>';
}
}
else//登入失敗
{
echo '<script>
$(function() {
$( "#dialog1" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>';
echo '<meta http-equiv=REFRESH CONTENT=1;url=login.php>';
}
?>
<div id="dialog1" title="提示訊息" style="display:none;"><p>帳號或密碼錯誤,請重新輸入一次</p></div>
<div id="dialog2" title="提示訊息" style="display:none;"><p>登入成功</p></div>
<div id="dialog3" title="提示訊息" style="display:none;"><p>登入失敗,您非展覽負責人或攤位負責人,無權進入後台</p></div>
</div>
</div>
</div>
</section>
<!-- Bottom Section -->
<section id="bottom" class="bottom-section">
Electronic Exhibition System project 2018
</section>
</body>