login.php
unknown
plain_text
a month ago
1.6 kB
2
Indexable
Never
<script src="https://accounts.google.com/gsi/client" async defer></script> <div id="g_id_onload" data-client_id="34178471422-5chptlf4ujd05p5a6suhvglmcc2f9jgk.apps.googleusercontent.com" data-callback="onSignIn" data-auto_prompt="false" data-ux_mode="redirect" data-login_uri="http://localhost/public_html/index.php"> </div> <div class="g_id_signin" data-type="standard"></div> <script> function onSignIn(response) { const { id_token, access_token, email } = response.credential; // Include email in response fetch('google_signin.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ id_token, access_token, email }), // Include email in JSON }) .then(response => response.json()) .then(data => { if (data.success) { // User's email address is valid, create a session and log them in // Implement your session creation and login logic here console.log('User is authenticated and can be logged in.'); // You can redirect to index.php here // window.location.href = 'index.php'; } else { // Display an error message or prompt the user to create a new account console.error('User email address not found in the database:', email); } }) .catch(error => { console.error('Server verification failed:', error); }); } </script>