• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN |DE - PHP Login Check

Status
Not open for further replies.

Kamikaze

Well-Known Member
Contributor
Heey!

I'm creating a Webinterface to control the bot vía Web with PHP and showing some things.
I do this for fun and testing and after I finished it I'll share this with you :)
Actually it's germany only for developing but I'll add english translation soon!

Here you can take a "first look" ( Control is disabled ;) )
http://xkamikaze.de/tsbot/control/

So here me question:
I do the login to the bot via php but with hard coded data like this:
PHP:
<?php
include("sinusbot.class.php");

// Domain und Port zum Webinterface
$sinusbot = new SinusBot("http://xkamikaze.de:8087");

// Login-Name und Passwort zum Webinterface
$sinusbot->login("user", "pass");

// Select Bot by UUID
$sinusbot->selectInstance("1234567890");

?>

But I want that the user have to login. Thats the form:
HTML:
<form action="?login=1" method="post">
   Benutzer:<br>
   <input type="Benutzer" size="20" maxlength="250" name="benutzer" /><br><br>
   Passwort:<br>
   <input type="password" size="20"  maxlength="250" name="passwort" /><br>
   <input type="submit" value="Login">
</form>

So.. Lets say they'll enter (User -> Paul / Pass -> 123) but if password is wrong he still log in. So how I can check/verify the entered password?

I know the data is stored in C:\SinusBot\data\db\xxxxxx.sqlite

But the passwords are crypted so i cant compare them with entered password.

Any Ideas?
You can answere in english and german :)
 

Xuxe

Containerholic
Staff member
is awesome!
V.I.P.
Contributor
Insider
Any Ideas?

Hi,

use the API call's, to login and obtain a Webtoken. See my signature, the api doc's content for the login should work also with the latest versions.

If you not get a success response, the credentials are wrong.
 

Kamikaze

Well-Known Member
Contributor
Ok, now I did this:
PHP:
$login = $sinusbot->login("admin", "admin");
echo $login["success"];

So when the login was succesfull I'll get "1" as value and i can check if login = 1 than...
would it be good or not?^^
 

Xuxe

Containerholic
Staff member
is awesome!
V.I.P.
Contributor
Insider
by opening the link it tell me:
Method Not Allowed

This is normal, it is a Post request, you do a GET.
//Edit: $login should contain a token, this token is required.
 
Status
Not open for further replies.
Top