-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodal.php
103 lines (80 loc) · 2.98 KB
/
modal.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="751808995199-jotb4s04fr4lcbc0a9qcu4lcjrsp754l.apps.googleusercontent.com">
<link rel="stylesheet" href="bootstrap-social.css">
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body style="background-color:black">
<div class="container">
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<br/>
<br/>
<br/>
<br/>
<h1 align="center" style="color:white">NJR Study Portal</h1>
<br/>
<div class="modal-content">
<div class="modal-header" style="background-color:red">
<h4 class="modal-title" align="center" style="color:white">Sign in</h4>
</div>
<div class="modal-body">
<div align="center" id="my-signin2"></div>
</div>
</div>
<h4 align="right" style="color:white"> by : NJR (Nikunj Janil Rohit)</h4>
</div>
</div>
</div>
<script>
$('#myModal').modal({
backdrop: 'static',
keyboard: false
})
$(document).ready(function(){$('#mymodal').open();})
function onSuccess(googleUser) {
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
ide = profile.getName();
ema = profile.getEmail();
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
$.post("checkvalidity.php",{name:ide, ema:ema},function(output){
$(".modal-header").html(output).show();
});
}
function onFailure(error) {
console.log(error);
}
function renderButton() {
gapi.signin2.render('my-signin2', {
'scope': 'profile email',
'width': 240,
'height': 50,
'longtitle': true,
'theme': 'white',
'onsuccess': onSuccess,
'onfailure': onFailure
});
}
</script>
<script src="https://apis.google.com/js/platform.js?onload=renderButton" async defer></script>
</body>
</html>