albertomario Posted June 29, 2009 Share Posted June 29, 2009 Hello, I need some help. I must check email and password entered by a user in a secondary script. I tried api but fail to check. I used "getclientsdatabyemail" but the password is not md5 encrypted. Can help me? 0 Quote Link to comment Share on other sites More sharing options...
albertomario Posted June 30, 2009 Author Share Posted June 30, 2009 Please....i need quickly one solution 0 Quote Link to comment Share on other sites More sharing options...
tomdchi Posted July 1, 2009 Share Posted July 1, 2009 This should fix you up: <?php require ('dbconnect.php'); $email = "youremail@someplace.com"; $query = "SELECT username, password FROM tbladmins WHERE roleid='1' LIMIT 1"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { $adminusername = $data['username']; $adminpassword = $data['password']; } $url = "https://whmcs_dir/includes/api.php"; $postfields["username"] = $adminusername; $postfields["password"] = $adminpassword; $postfields["action"] = "getclientsdatabyemail"; $postfields["email"] = $email; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data = curl_exec($ch); curl_close($ch); //print_r ($data); //exit(); $data = explode(";", $data); foreach ($data as $temp) { $temp = explode("=", $temp); $results[$temp[0]] = $temp[1]; } if ($results["result"] == "success") { $clientid = $results["userid"]; $firstname = $results["firstname"]; $lastname = $results["lastname"]; $companyname = $results["companyname"]; $address1 = $results["address1"]; $address2 = $results["address2"]; $city = $results["city"]; $state = $results["state"]; $postcode = $results["postcode"]; $phonenumber = $results["phonenumber"]; } else { die("An error occured. Please contact support. ({$results['message']})"); } echo $clientid; ?> enjoy, Tom 0 Quote Link to comment Share on other sites More sharing options...
JulesR Posted July 5, 2009 Share Posted July 5, 2009 Hate to dig up an old thread, but just to let you know that the above won't work. It's a nice idea, but unfortunately the passwords in the database are MD5 encrypted, whereas the API needs the unencrypted password. 0 Quote Link to comment Share on other sites More sharing options...
tomdchi Posted July 5, 2009 Share Posted July 5, 2009 Hate to dig up an old thread, but just to let you know that the above won't work. It's a nice idea, but unfortunately the passwords in the database are MD5 encrypted, whereas the API needs the unencrypted password. I guess you haven't tested this? I use this all the time and it works fine. 0 Quote Link to comment Share on other sites More sharing options...
JulesR Posted July 5, 2009 Share Posted July 5, 2009 I guess you haven't tested this? I use this all the time and it works fine. EDIT: Ignore me, missed the md5 part further down, sorry 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.