-
Notifications
You must be signed in to change notification settings - Fork 0
/
signin.php
54 lines (49 loc) · 1.47 KB
/
signin.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
<html>
<div id="loading">
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<center><img id="loading-image" img src="images/giphy.gif" class="center"/></center>
<body onload="javascript: getLocation(showPosition)">
<script>
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x1 = position.coords.latitude;
y1 = position.coords.longitude;
console.log(x1+" "+y1);
window.location = "login/session_vars.php?lat="+x1+"&lng="+y1;
}
</script>
</div><script language="javascript" type="text/javascript">
$(window).load(function() {
$('#loading').hide();
});
</script>
</body>
</html>
<?php
//error_reporting(0);
session_start();
include("connection.php");
// username and password sent from form
$email = $_POST['email'];
$password = $_POST['pass'];
$sql = "SELECT * FROM registration WHERE email = '$email' and pass = '$password'";
$result = $conn->query($sql);
if($result->num_rows > 0 ) {
$row = $result->fetch_assoc();
$_SESSION['email']=$email;
$_SESSION['id']=$row['id'];
//header('location:login/home.php');
}
else{
$message = "Username and/or Password incorrect.\\nTry again.";
echo "<script type='text/javascript'>alert('$message');";
echo 'window.location.href = "index.html"</script>';
//header('location:index.html');
}
?>