leewells Posted July 9, 2012 Share Posted July 9, 2012 (edited) Greetings! I'm creating a module that will automatically log someone into a Hivelocity account to create orders, grab charts, data usage, etc for those of us that resell servers for them (anyone interested in buying something like this let me know btw). We have currently this up using cURL to automatically login, grab the data, and log out every so often. But now I'm having an issue with the password change function (and not what you think lol). The way it is setup is, the server will be given a password and the password can be reset via remote KVM or via the control panel. Right now I'm working on the Webmin control panel interface. The password change function works precisely as intended in the back-end (admin side) but when the user imitates it, it throws the error "Password Change Failed!" which is not in any of the docs and not anything we've hooked into this thing. If anyone has had similar problems with the mod_passwordchange() function, please let me know what you did to get around that or what variable I may be missing to set or catch. Thanks for any help ahead of time. function hivelocity_ChangePassword($params) { require('/home/my/public_html/modules/servers/hivelocity/changepw.php'); // Library of curl functions to reset passwords for Webmin. Planned: Hivelocity KVMs $result = mysql_query("SELECT * FROM `mod_hivelocity` WHERE `serviceid`='".$params['serviceid']."'"); $data = mysql_fetch_array($result); $passen = mydecrypt($data['cpass']); // mydecrypt($string) and myencrypt($string) is a custom 1024-bit, 32-layer // cypher and encryption algorithm located in changepw.php // We need to rethink this, maybe -- it can be CPU demanding. if(empty($data['cpass'])) { mysql_query("UPDATE `mod_hivelocity` SET `cpass`='".myecrypt($params["password"])."' WHERE `serviceid`='".$params['serviceid']."'"); } if($params["password"] == $passen) { $result = "Passwords already match!"; // No need to reset the password and pull a curl request if it is already the same. } else { $thepage = GetValue($params["serverip"],$params["username"],$passen,$params["password"]); // Lights, Camera, Action Function ref in changepw.php if($thepage == 'successfully') { mysql_query("UPDATE `mod_hivelocity` SET `cpass`='".myecrypt($params["password"])."' WHERE `serviceid`='".$params['serviceid']."'"); $result = "success"; } else { $result = "Could not change the password likely because the root password was already changed."; } } return $result; } Edited July 9, 2012 by leewells Added code.. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.