MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u915722082/.nvm/../public_html/at/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/.nvm/../public_html/at/_ajax_users.php
<?php
	session_start();
	require_once "_config.php";
	
	$action=$_POST["action"];
	 
	if($action=="Insert"){
		 
		 
		 
		$name=mysqli_real_escape_string($con,$_POST["name"]);
		$mail=mysqli_real_escape_string($con,$_POST["mail"]);
		$password=mysqli_real_escape_string($con,$_POST["password"]);  
		$data = [];
		$sql = "select * from tbl_user where mail='{$mail}'";
		$row = single($con,$sql);
		if($row){
			$data["status"] = 0;
		}else{ 
			$sql="insert into tbl_user (name,mail,password,roll) values ('{$name}','{$mail}','{$password}','USER') ";
			$con->query($sql);  
			
			$now = date("Y-m-d H:i:s");
			$sql1="insert into tbl_logs (uid,log_date,log_type,log_mode,log_text) values ('{$_SESSION["logs"]["uid"]}','{$now}','User','Entry','{$mail}')";  
			$con->query($sql1);	 
			$cid = $con->insert_id;
			
			$data["status"] = 1;
			$data["td1"] = "";
			$data["td2"] = "{$mail}";
			$data["td3"] = "{$password}";
			$data["td4"] = "{$roll}"; 
			 
			$data["td5"] = "
				<button type='button' class='btn btn-sm btn-icon btn-active-color-primary  edit' uid='{$uid}' > <i class='fa fa-edit'></i> </button>
				<button type='button' class='btn btn-sm btn-icon btn-active-color-primary del_row' uid='{$uid}'> <i class='fa fa-trash'></i> </button>
			";
			flashN('msg','User Status','User Added Successfully','info');
			
			
		}
		echo json_encode($data);
	}
		
	if($action=="Edit"){
		
		$mail=mysqli_real_escape_string($con,$_POST["mail"]);
		$password=mysqli_real_escape_string($con,$_POST["password"]);
		
		$data = [];
		$sql = "select * from tbl_user where mail='{$mail}' and uid<>'{$_POST["uid"]}' ";
		$row = single($con,$sql);
		if($row){
			$data["status"] = 0;
		}else{
				
			$sql="update tbl_user set mail='{$mail}',password='{$password}',roll='USER' where uid='{$_POST["uid"]}'";
			$con->query($sql);
			
			$now = date("Y-m-d H:i:s"); 
			$sql1="insert into tbl_logs (uid,log_date,log_type,log_mode,log_text) values ('{$_SESSION["logs"]["uid"]}','{$now}','User','Change','{$mail}')";  
			$con->query($sql1); 
			$data["status"] = 1;		 
			$data["td2"] = "{$mail}";
			$data["td3"] = "{$password}";
			$data["td4"] = "{$roll}"; 
			flashN('msg','User Status','User Updated Successfully','info');
		}
		echo json_encode($data);
	}
	
	if($action=="Delete"){ 
		$now = date("Y-m-d H:i:s");
		
		$row=single($con,"select * from tbl_user  where uid='{$_POST["uid"]}'"); 
 		
		$sql1="insert into tbl_logs (uid,log_date,log_type,log_mode,log_text) values ('{$_SESSION["logs"]["uid"]}','{$now}','User','Delete','{$row["mail"]}')";  
		$con->query($sql1);     
		
		 
		$sql="delete from tbl_user where uid='{$_POST["uid"]}'"; 
		$con->query($sql); 
		flashN('msg','User Status','User Deleted Successfully','info');
		     
	}  
?>  

		

MMCT - 2023