-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.jsp
More file actions
63 lines (57 loc) · 2 KB
/
Copy pathIndex.jsp
File metadata and controls
63 lines (57 loc) · 2 KB
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
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>index</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="css/main.css" />
<script type="text/javaScript">
<!--
function shout(x)
{
alert(x);
}
-->
</script>
</head>
<body>
<header id="header">
<h1>Control Panel</h1>
<p>Getting rich through effective mobile money business management </p>
</header>
<form id="signup-form" method="post" action="/MobileMoney/Index.jsp">
<input type="text" name="username" id="email" placeholder="User-name" />
<input type="submit" value="Log in" name ="login" />
</form>
</body>
<%
if(request.getParameter("login")!=null)
{
String username = request.getParameter("username");
%>
<sql:setDataSource
var="dbcon" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mobile"
user="root" password=""
/>
<sql:query dataSource="${dbcon}" var="rs">select * from user where username="<%=username%>" and status="admin";</sql:query>
<c:set var="count" value="${0}"/>
<c:forEach items="${rs.rows}" var="rt">
<c:set var="count" value="${count+1}"/>
</c:forEach>
<c:if test="${count==1}">
<script type="text/javascript">
shout("Log in successful");
window.location='/MobileMoney/Menu.jsp';
<%
session.setAttribute("username",username);
%>
</script>
</c:if>
<%
}
%>
</html>