-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserlog.php
More file actions
44 lines (39 loc) · 1.6 KB
/
userlog.php
File metadata and controls
44 lines (39 loc) · 1.6 KB
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
<?php
session_start();
// echo("hello ".$_SESSION['username']);
if(isset($_SESSION['username']));
//echo "<h3 class='links' > Signed In as ".$_SESSION['username'].'<a href="login.php?logout=1">Log Out</a></h3>';
else
die ("not logged in, please log in!!!!<br> <a href=\"login.php\">login</a>");
if(isset($_GET['userid'])&& isset($_GET['type']))
{
require 'dbConnect.php';
$conn = getConnection();
if($conn->connect_error)
{
header("Location: signUp.php?status=&failed" );
}
$stmt = $conn->prepare("INSERT INTO userlog (user_id,type) VALUES (?, ?)");
$stmt->bind_param("is", $_GET['userid'],$_GET['type']);
$isWritten=false;//echo $Name.$ph_no.$vehicle_no.$isregular;
if($stmt->execute())
{
$isWritten=true;
$errorcode=100;
}else {
$isWritten=false;
$errorcode=100;
}
}
if(!$isWritten)
{
die ("ERROR writing log");
}
else
{
if($_GET['type']=="login")
header("Location: main.php");
else if($_GET['type']=="logout")
header("Location: login.php?logout=1");
}
?>