-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.jsp
166 lines (136 loc) · 4.39 KB
/
index.jsp
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
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="bootstrap.css" />
<link rel="icon" type="image/ico" href="github.ico">
<script>
function loginsignupa()
{
var Passport = document.getElementById("abcd");
var Passporta = document.getElementById("abcde");
Passporta.style.display = "none";
Passport.style.display = "block";
}
function loginsignupb()
{
var Passport = document.getElementById("abcd");
var Passporta = document.getElementById("abcde");
Passport.style.display = "none";
Passporta.style.display = "block";
}
</script>
<title>Github</title>
</head>
<body >
<%! String user = ""; %>
<%
boolean isLogged = false;
Cookie cks[] = request.getCookies();
for(int i = 0; i < cks.length; i++) {
if(cks[i].getName().equals("logged_user")) {
isLogged = true;
user = cks[i].getValue();
break;
}
}
if(!isLogged) {
%>
<nav class="navbar navbar-default" >
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="github.ico" height="24px" width="24px">
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a class="btn btn-default" href="#" onclick="loginsignupb()" role="button">Login</a></li>
<li><a class="btn btn-default" href="#" onclick="loginsignupa()" role="button">Signup</a></li>
<!--<li><a href="http:www.hackerearth.com/login">Delete</a></li>
<li><a href="loginsignup()">Update</a></li>-->
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Git Search">
</div>
<button type="submit" class="btn btn-default">search</button>
</form>
</div>
</div>
</nav>
<div id="abcde">
<form action="github.jsp" style="padding:10px 20% 50% 20%;">
<table class="table table-hover" style="border:2px solid #2980b9;">
<tr >
<td colspan="2" align="center" class="bg-primary">
<h1>Login</h1>
</td>
</tr>
<tr>
<td ><b>User Name:</b></td>
<td ><input type="text" class="form-control" name="username" required></td>
</tr>
<tr>
<td ><b>Password:</b></td>
<td ><input type="Password" class="form-control" name="password" required></td>
</tr>
<tr>
<td colspan="2" align="center">
<input class="btn btn-primary" type="submit" value="Login"></td>
</tr>
</table>
</form>
</div>
<div id="abcd" style="display: none">
<form action="http://www.google.com" style="padding:10px 20% 50% 20%;">
<table class="table table-hover" style="border:2px solid #2980b9;">
<tr >
<td colspan="2" align="center" class="bg-primary">
<h1>Sign up</h1>
</td>
</tr>
<tr>
<td ><b>First Name:</b></td>
<td ><input type="text" class="form-control" name="aa" required></td>
</tr>
<tr>
<td ><b>Last Name:</b></td>
<td ><input type="Text" class="form-control" name="bb" required></td>
</tr>
<tr>
<td ><b>Age:</b></td>
<td ><input type="text" class="form-control" name="cc" required></td>
</tr>
<tr>
<td ><b>Email:</b></td>
<td ><input type="email" class="form-control" name="dd" required></td>
</tr>
<tr>
<td ><b>Address:</b></td>
<td ><textarea class="form-control" name="cc" required></textarea></td>
</tr>
<tr>
<td ><b>DOJ:</b></td>
<td ><input type="text" class="form-control" name="cc" required></td>
</tr>
<tr>
<td colspan="2" align="center" class="bg-primary" >
<input type="checkbox" required> i accept the terms and conditions </td>
</tr>
<tr>
<td colspan="2" align="center">
<input class="btn btn-primary" type="submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
<% } else { %>
<span>hi there</span>
<% response.sendRedirect("github.jsp");
} %>
</body>
</html>