User and pass of user (not admin)
p/s: How can I set default “Website limit = 0” for every new user register?
My code for check login :
class WP_Cyber_Panel{
//Server credentials
protected $cyberpanel_hostname = '';
protected $admin_user = '';
protected $admin_pass = '';
public function __construct($hostname, $username, $password){
$this->cyberpanel_hostname = $hostname;
$this->admin_user = $username;
$this->admin_pass = $password;
}
// curl function
private function curl_result($action, $postdata){
$postdata = json_encode($postdata);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://" . $this->cyberpanel_hostname . ":8090/api/" . $action);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
return curl_exec($ch);
}
// Login as User (ERROR)
// {
// "loginStatus": "1",
// "error_message": "Error if any.",
// }
public function user_login($username, $password){
$action = 'loginAPI';
$postdata = array(
'username' => $username,
'password' => $password
);
return $this->curl_result($action, $postdata);
}
// Some other function
}
$cyberpanel = new WP_Cyber_Panel('ip_of_server', 'admin_name', 'admin_pass');
echo 'pre';
var_dump( $cyberpanel->user_login('user_name', 'user_pass') );
echo 'pre';