hello fellow members i would like some help i want people to register on my site and i want to have the users to use the same login on my minecraft server , is this possible? what would i need to do, is there a plugin for that? thanks in advance!
The best way to do this is using a database. Then your website and the server easily can access the data. No idea if simpleauth already supports sql. But in this forum you'll find more about mysql and login
Make your website share the same database as SimpleAuth. You can also choose to write a DataProvider for SimpleAuth based on your database.
i have a little problem connecting i have the database setup and login /registration works fine but on the site i let the database login use the simpleauth login like this $uau['db'] = 'simpleauth'; $uau['table'] = 'simpleauth_players'; $uau['id'] = 'name'; $uau['salt'] = ''; $uau['cms'] = 'SimpleAuth'; $uau['cuser'] = 'name'; $uau['cpass'] = 'hash'; $uau['pm'] = ''; $uau['posts'] = ''; $uau['mail'] = 'user_email'; $uau['ip'] = 'lastip'; $uau['time'] = 'time'; am i doing something wrong? it says invalid login when logging into the website..
I've managed to do this for one of my sites, it is not currently connected to a database so it may show the error. http://jacknoordhuis.pe.hu/login.php
This should work if you include it as a file on your website (I assume you know basic PHP and will know to change the namespace and stuff) PHP: <?phpnamespace website;function checkHash($str1, $str2) { if(strlen($str1) != strlen($str2)) { return false; } else { $res = $str1 ^ $str2; $ret = 0; for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]); return !$ret; }}class Auth { private $username; private $password; public $dbhost = "host.com"; public $dbuser = "root"; public $dbpword = "root"; public $db = "name"; public function __construct($username, $password) { $this->username = $username; $this->password = $password; $this->database = new \mysqli($this->dbhost, $this->dbuser, $this->dbpassword, $this->db, 3306); if($this->database->connect_error) { echo("Couldn't connect to Database:" . $this->database->connect_error); return; } } public function register($username, $password) { if($this->validUsername($username) and $this->validPassword($password)) { $this->database->query("INSERT INTO simpleauth_players (name, hash) VALUES ('" . $this->database->escape_string(strtolower($username)) . "', '" . $this->hash($username, $password) . "') "); return true; } return false; } public function login($username, $password) { if($this->validUsername($username) and $this->validPassword($password)) { $result = $this->database->query("SELECT * FROM simpleauth_players WHERE name = '" . $this->database->escape_string($username). "'"); if($result instanceof \mysqli_result) { $result->fetch_assoc(); $result->free(); if(isset($data["name"]) and strtolower($data["name"] === $name) and isset($data["hash"]) and checkHash($data["hash"], $this->hash($username, $password))) { return true; } } } return false; } //Use SimpleAuth's hashing method to make it compatible public function hash($salt, $password) { return bin2hex(hash("sha512", $password . $salt, true) ^ hash("whirlpool", $salt . $password, true)); } //Checks for a valid Username public function validUsername($name) { if($name !== null and count_chars($name) >= 4) { return true; } return false; } //Checks for a valid Password public function validPassword($password) { if($password !== null and count_chars($password) >= 6) { return true; } return false; }} To use this you will need to do: PHP: $auth = new \Auth($username, $password);$auth->login();//or$auth->register();