Jump to content

User authentication issue.. Help..


Mutlu

Recommended Posts

Hi everyone.. 

I'm the new guy at this community and whmcs system. 

I'm started work with whmcs system short time ago and i have some problems. 

I think my problems not so complicated but i cant solve that and i need litle help.

I'm trying to do make user authentication with whmcs api everythink seems well but when i try to login form my software it's rejecting and creating {"result":"error","message":"Invalid password provided"} mesage.

 

How i can fix this issue? I need idea.. You can find my codes below.

if(isset($_POST['gonder'])) {
    $kullaniciAdi = $_POST["kulAdi"];
    $parola = $_POST["pass"];

    /**
     * WHMCS Sample API Call
     *
     * @package    WHMCS
     * @author     WHMCS Limited <development@whmcs.com>
     * @copyright  Copyright (c) WHMCS Limited 2005-2016
     * @license    http://www.whmcs.com/license/ WHMCS Eula
     * @version    $Id$
     * @link       http://www.whmcs.com/
     */

// API Connection Details
    $whmcsUrl = "http://***.***.***.***/whmcs/includes/api.php";

// For WHMCS 7.2 and later, we recommend using an API Authentication Credential pair.
// Learn more at http://docs.whmcs.com/API_Authentication_Credentials
// Prior to WHMCS 7.2, an admin username and md5 hash of the admin password may be used.
    $username = $kullaniciAdi;
    $password = $parola;

    $api_identifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
    $api_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
    $accessKey = 'xxxxxxxx';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $whmcsUrl);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,
        http_build_query(
            array(
                'action' => 'ValidateLogin',
                // See https://developers.whmcs.com/api/authentication
                'username' => $api_identifier,
                'password' => $api_secret,
                'accesskey' => $accessKey,
                'username' => $kullaniciAdi,
                'password2' => $parola,
                'responsetype' => 'json',
            )
        )
    );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    curl_close($ch);
    $sonuc = json_decode($response);

    if ($sonuc->{'result'} != "error"){
        echo "Girişiniz onaylandı ana menüye yönlendiriliyorsunuz";
    } else {
        echo $response."<br />";
        echo $sonuc->{'result'}."<br />";
        echo $sonuc->{'message'}."<br />";
    }

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated