Hello, I have 2 servers now, and i have 2 diffrent logins on it, i have made so a button could switch between the servers and an autologin, but how do i add users to both of them? I have made an add user form and it works, but it adds a user to only the 1st server (both of them are using mysql) and if you want to add a user to nextcloud, you have to do it manually. How do you add an account to nextcloud? Which database it uses for users and how does it encrypt passwords (if i could get that info)? My add user form:
<form class="col s12" method="post" action="../php/adduser.php">
<div class="row">
<div class="input-field col s6">
<input id="first_name" type="text" class="validate" autocomplete="off" name="name">
<label for="first_name">Username</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input id="password" type="password" class="validate" autocomplete="off" name="pass">
<label for="password">Password</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input id="msterpasword" type="password" class="validate" autocomplete="off" name="masterpass">
<label for="password">Master Password</label>
</div>
</div>
<!-- <input type="submit" value="Add User" class="waves-effect waves-light btn user" name="button-add"/>-->
<button type="submit" class="waves-effect waves-light btn user" name="btn-add">Add User</button>
</form>
And My php file, addusers.php:
<?php
include(âsession.phpâ);
include(âconfig.phpâ);
if(isset($_POST[âbtn-addâ])){
// basic name validation
$name=$_POST[ânameâ];
// $name1=$name;
$pass=$_POST['pass'];
$masterpass=$_POST[âmasterpassâ];
$passwordm = hash(âsha256â, $masterpass);
$passwordm=MD5($passwordm);
if ($_POST[âmasterpassâ]==âzerouserâ) {
// password encrypt using SHA256();
$password = hash(âsha256â, $pass);
$password=MD5($password);
$sql = "INSERT INTO login(username,password) VALUES('$name','$password')";
$result=mysqli_query($con,$sql);
header(âLocation: âŠ/pages/options.phpâ);
} else {
$fmsg = âMaster Password does not matchâ;
header(âLocation: âŠ/pages/options.phpâ);
}
}
?>