-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
379 lines (343 loc) · 17.3 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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<?php
session_start();
include("./config/config.php");
if(isset($_SESSION['username'])){
header("Location: ./templates/dashboard.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>WordFlow</title>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="297927731874-btp4j57fqaatg06lp7k3u7uf4am6hl7a.apps.googleusercontent.com" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"><!--
<link rel="javascript" href="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.slim.min.js">
<link rel="javascript" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"> -->
<script src="http:////ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http:////maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- put first the jquery path, otherwise the bootstrap.js won't work-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<!-- <script src="//cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.js"></script> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://www.jqueryscript.net/demo/jQuery-Plugin-For-Water-Ripple-Animation-ripples/js/jquery.ripples.js">
</script>
<script type="text/javascript" src="./scripts/angular-contact-form.js"></script>
<link rel="stylesheet" href="./styles/index.css"/>
<script>
if(typeof(EventSource) !== "undefined") {
var source = new EventSource("./db/sse.php");
source.onmessage = function(event) {
document.getElementById("result").innerHTML = "We are a family of "+event.data + " active bloggers!<br>";
};
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
$(document).ready(function() {
$('#first').ripples('show');
});
clicked = false;
function login() {
clicked = true;
}
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
var name = profile.getName();
var pic = profile.getImageUrl();
var email = profile.getEmail();
var auth2 = gapi.auth2.getAuthInstance();
auth2.disconnect();
if (clicked) {
var Form, Input1, Input2,Input3;
Form = document.createElement('form');
Form.action = './db/login.php';
Form.method = 'post';
Input1 = document.createElement('input');
Input1.type = 'hidden';
Input1.name = 'name';
Input1.value = name;
Input2 = document.createElement('input');
Input2.type = 'hidden';
Input2.name = 'pic';
Input2.value = pic;
Input3 = document.createElement('input');
Input3.type = 'hidden';
Input3.name = 'email';
Input3.value = email;
Input4 = document.createElement('input');
Input4.type = "hidden";
Input4.name = 'googleSignIn';
Input4.value = 1;
Form.appendChild(Input1);
Form.appendChild(Input2);
Form.appendChild(Input3);
Form.appendChild(Input4);
document.getElementById('hidden_form_container').appendChild(Form);
Form.submit();
}
}
</script>
</head>
<body>
<!-- Navigation -->
<nav id="topNav" class="navbar navbar-expand-lg fixed-top navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<!-- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar">
user_i <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> -->
<a class="navbar-brand page-scroll" href="#first">WordFlow</a>
</div>
<div class="navbar-collapse collapse" id="bs-navbar">
<ul class="nav navbar-nav">
<li>
<a class="page-scroll" href="#">Intro</a>
</li>
<li>
<a class="page-scroll" href="#">Highlights</a>
</li>
<li>
<a class="page-scroll" href="#">Gallery</a>
</li>
<li>
<a class="page-scroll" href="#">Features</a>
</li>
<li>
<a class="page-scroll" href="#">Contact</a>
</li>
</ul>
<ul class="nav navbar-right">
<li>
<a class="page-scroll" title="About WordFlow" href="#about">About</a>
</li>
</ul>
</div>
</div>
</nav>
<script type="text/javascript">
$('a.page-scroll').bind('click', function(event) {
var $ele = $(this);
$('html, body').stop().animate({
scrollTop: ($($ele.attr('href')).offset().top - 60)
}, 1450, 'easeInOutExpo');
event.preventDefault();
});
</script>
<!--SignUp Modal -->
<div id="SignUp" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<!-- <div class="container">
<div class="row"> -->
<div class="text-center">
<h2 class="margin-top-0 wow fadeIn">Sign Up</h2>
<hr class="primary">
<p>Sign Up to connect with people and discover new opportunities!</p>
</div>
<div class="col-lg-10 mx-auto text-center">
<form class="contact-form row" action="./db/register.php" method="POST"><br>
<div class="col-md-4">
<label>First Name</label>
<input type="text" class="form-control" placeholder="First Name" name="firstname" required>
</div>
<div class="col-md-4">
<label>Middle Name</label>
<input type="text" class="form-control" placeholder="Middle Name" name="middlename" >
</div>
<div class="col-md-4">
<label>Last Name</label>
<input type="text" class="form-control" placeholder="Last Name" name="lastname" required>
</div>
<br>
<div class="col-md-6"><br>
<label>Username</label>
<input type="Username" class="form-control" placeholder="Username" name="username" required>
</div>
<div class="col-md-6"><br>
<label>Password</label>
<input type="Password" class="form-control" placeholder="Password" name="password" required>
</div>
<br>
<div class="col-md-12"><br>
<label>Email</label>
<input type="email" class="form-control" placeholder="Email" name="email" required>
</div>
<div class="col-md-4"><br>
<label>Phone</label>
<input type="tel" class="form-control" placeholder="Phone" name="phone" pattern="[0-9]{10}" required>
</div>
<div class="col-md-4"><br>
<label>Gender</label><br>
<select name="gender" class="form-control">
<option value="M">Male</option>
<option value="F">Female</option>
</select>
</div>
<div class="col-md-4"><br>
<label>Birthday</label>
<input type="date" name="bday" class="form-control" required>
</div>
<div class="col-md-4"><br>
<label>Country</label><br>
<input type="text" class="form-control" placeholder="Country" name="country" required>
</div>
<div class="col-md-4"><br>
<label>City</label><br>
<input type="text" class="form-control" placeholder="City" name="city" required>
</div>
<div class="col-md-4"><br>
<label>State</label><br>
<input type="text" class="form-control" placeholder="State" name="state" required>
</div>
<div class="col-md-4 " style="margin-left: 110px;"> <br>
<label>Street</label><br>
<input type="text" class="form-control" placeholder="Street" name="street" required>
</div>
<div class="col-md-4 " ><br>
<label>Pincode</label><br>
<input type="text" class="form-control" placeholder="Pincode" name="pincode" required>
<!-- textarea class="form-control" rows="9" placeholder="Address" name="address" required></textarea> -->
</div>
<div class="mx-auto col-md-9 ">
<label></label><br>
<input type="submit" class="btn btn-primary btn-lg center-block" name="Submit">
<!-- <button type="submit" class="btn btn-primary btn-lg center-block" data-dismiss="modal" aria-hidden="true" onclick="">Submit</button> -->
</div>
</form>
</div>
<!-- </div>
</div> -->
<br/>
</div>
</div>
</div>
</div>
<!-- Modal End -->
<!-- Login Modal -->
<div id="LogIn" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-body">
<!-- <div class="container">
<div class="row"> -->
<div class="text-center">
<h2 class="margin-top-0 wow fadeIn">Log In</h2>
<hr class="primary">
<p>Welcome Back!</p>
</div>
<div class=" text-center"> <!-- col-lg-10 col-lg-offset-1 -->
<form action="./db/login.php" method="POST">
<div class="col-md-9 mx-auto text-center">
<label>Username</label>
<input type="Username" class="form-control " placeholder="Username" name="username" required>
</div>
<div class="col-md-9 mx-auto text-center">
<label>Password</label>
<input type="Password" class="form-control" placeholder="Password" name="password" required>
</div>
<div class="mx-auto">
<label></label><br>
<input type="submit" class="btn btn-primary btn-lg center-block" name="Submit">
<br>OR<br>Sign In with Google<br>
<div class="g-signin2" onclick="login()" data-onsuccess="onSignIn" style="margin-left: 175px;"></div>
<!-- <button type="submit" class="btn btn-primary btn-lg center-block" data-dismiss="modal" aria-hidden="true" onclick="">Submit</button> -->
</div>
</form>
</div>
<!-- </div>
</div> -->
<br/>
<!-- <button class="btn btn-primary btn-lg center-block" data-dismiss="modal" aria-hidden="true">Submit </button> -->
</div>
</div>
</div>
</div>
<!-- Modal End -->
<header id="first">
<div class="header-content">
<div class="inner">
<h1>Word-Flow</h1>
<hr class="divider my-4">
<h4>Discover new ideas, share your imagination.</h4>
<br><br>
<button class="btn btn-primary btn-xl" data-toggle="modal" data-target="#LogIn">Log In</button>
<button class="btn btn-primary btn-xl" data-toggle="modal" data-target="#SignUp" >Sign Up</button>
<!--
<a href="#video-background" id="toggleVideo" data-toggle="collapse" class="btn btn-primary btn-xl">Toggle Video</a> <a href="#one" class="btn btn-primary btn-xl page-scroll">Get Started</a> -->
</div>
</div>
</header>
<section class="py-5" id="about">
<div class="container">
<h2 class="font-weight-light">About</h2>
<h4><div id="result"></div></h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus ab nulla dolorum autem nisi officiis blanditiis voluptatem hic, assumenda aspernatur facere ipsam nemo ratione cumque magnam enim fugiat reprehenderit expedita.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus ab nulla dolorum autem nisi officiis blanditiis voluptatem hic, assumenda aspernatur facere ipsam nemo ratione cumque magnam enim fugiat reprehenderit expedita.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellendus ab nulla dolorum autem nisi officiis blanditiis voluptatem hic, assumenda aspernatur facere ipsam nemo ratione cumque magnam enim fugiat reprehenderit expedita.
</p>
<p>Need a kickstart? Here are 10 reasons why you should start blogging!</p>
<iframe width="1000" height="345" src="https://www.youtube.com/embed/osHHhRpoUWk">
</iframe>
</div>
</section>
<section class="py-5" id="contact">
<div class="container">
<h2 class="font-weight-light">Contact Us!</h2>
<h4><div id="result"></div></h4>
<app-contact></app-contact>
</div>
</section>
<footer id="footer">
<div class="container-fluid">
<div class="row">
<div class="col-xs-6 col-sm-3 column">
<h4>Information</h4>
<ul class="list-unstyled">
<li><a href="">Products</a></li>
<li><a href="">Services</a></li>
<li><a href="">Benefits</a></li>
<li><a href="">Developers</a></li>
</ul>
</div>
<div class="col-xs-6 col-sm-3 column">
<h4>About</h4>
<ul class="list-unstyled">
<li><a href="#">Contact Us</a></li>
<li><a href="#">Delivery Information</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms & Conditions</a></li>
</ul>
</div>
<div class="col-xs-12 col-sm-3 column">
<h4>Stay Posted</h4>
<form>
<div class="form-group">
<input type="text" class="form-control" title="No spam, we promise!" placeholder="Tell us your email">
</div>
<div class="form-group">
<button class="btn btn-primary" data-toggle="modal" data-target="#alertModal" type="button">Subscribe for updates</button>
</div>
</form>
</div>
</div>
</footer>
<div id="hidden_form_container" style="display:none;"></div>
</body>
</html>
<?php
if(isset($_SESSION["loginFail"]))
{
if($_SESSION["loginFail"]==1){
echo '<script language="javascript">';
echo 'alert("Login Failed. Input valid Credentials/ try using registered email")';
echo '</script>';
$_SESSION["loginFail"]=0;
}
}?>