0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.14.255.58


Current Path : /proc/thread-self/root/var/www/html/vskub/pgadm/admin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/vskub/pgadm/admin/src/createUser.php

<?php

include ("database.php");

$user = $_POST['usrname'];
$password = $_POST['password'];
//check weather user exist
$select_usr = "select fusername from masuser where fusername = '{$user}'";
$result = mysqli_query($conn,$select_usr);
$count = mysqli_num_rows($result);
if($count == 0)
{
	$insert_usr = "insert into masuser(fusername,fpasswd,fusertype) values ('{$user}','{$password}','usr')";
	$result = mysqli_query($conn,$insert_usr);
	if($result)
	{
		$response['status'] = "success";
		$response['msg'] = "Created user Successfully";
		echo json_encode($response);
	}
	else
	{
		$response['status'] = "error";
		$response['msg'] = "Error while inserting";
		echo json_encode($response);
	}
}
else
{
	$update_usr = "update masuser set fpasswd = '{$password}' where fusername = '{$user}' and fusertype = 'usr'";
	$result = mysqli_query($conn,$update_usr);
	if($result)
	{
		$response['status'] = "success";
		$response['msg'] = "Updated password Successfully";
		echo json_encode($response);
	}
	else
	{
		$response['status'] = "error";
		$response['msg'] = "Error while Updating";
		echo json_encode($response);
	}
}