-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogdb.php
More file actions
28 lines (27 loc) · 772 Bytes
/
logdb.php
File metadata and controls
28 lines (27 loc) · 772 Bytes
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
<?php
include 'dbconnection.php';
$mob=$_POST["mobile"];
$password=$_POST["password"];
if($mob!="" && $password!="")
{
$sql_query="select count(*) as cntUser from users where mobile='".$mob."' and password='".$password."'";
$result=mysqli_query($conn,$sql_query);
$row=mysqli_fetch_array($result);
$count=$row['cntUser'];
if($count>0)
{
$_SESSION['mobile']=$mob;
header('Location: homepage.php');
$sql="select username from users where mobile='".$mob."'";
$result=mysqli_query($conn, $sql);
$user=mysqli_fetch_assoc($result);
$file=fopen("user.txt","w") or die("Unable to open file!");
fwrite($file,$user["username"]);
fclose($file);
}
else
{
echo "Invalid username/password";
}
}
?>