forked from Business/AccountHub
		
	Add option to get user info by ID, not name
This commit is contained in:
		
							parent
							
								
									2a9ad78477
								
							
						
					
					
						commit
						0e13f77e05
					
				
							
								
								
									
										20
									
								
								api.php
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								api.php
									
									
									
									
									
								
							| @ -49,11 +49,23 @@ switch ($VARS['action']) { | |||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     case "userinfo": |     case "userinfo": | ||||||
|         if (user_exists($VARS['username'])) { |         if (!is_empty($VARS['username'])) { | ||||||
|             $data = $database->select("accounts", ["uid", "realname (name)", "email", "phone" => ["phone1 (1)", "phone2 (2)"]], ["username" => $VARS['username']])[0]; |             if (user_exists($VARS['username'])) { | ||||||
|             exit(json_encode(["status" => "OK", "data" => $data])); |                 $data = $database->select("accounts", ["uid", "username", "realname (name)", "email", "phone" => ["phone1 (1)", "phone2 (2)"]], ["username" => $VARS['username']])[0]; | ||||||
|  |                 exit(json_encode(["status" => "OK", "data" => $data])); | ||||||
|  |             } else { | ||||||
|  |                 exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)])); | ||||||
|  |             } | ||||||
|  |         } else if (!is_empty($VARS['uid'])) { | ||||||
|  |             if ($database->has('accounts', ['uid' => $VARS['uid']])) { | ||||||
|  |                 $data = $database->select("accounts", ["uid", "username", "realname (name)", "email", "phone" => ["phone1 (1)", "phone2 (2)"]], ["uid" => $VARS['uid']])[0]; | ||||||
|  |                 exit(json_encode(["status" => "OK", "data" => $data])); | ||||||
|  |             } else { | ||||||
|  |                 exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)])); | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             exit(json_encode(["status" => "ERROR", "msg" => lang("login incorrect", false)])); |             header("HTTP/1.1 400 Bad Request"); | ||||||
|  |             die("\"400 Bad Request\""); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     case "userexists": |     case "userexists": | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user