Show DevBest FuseLicense Library

Status
Not open for further replies.

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
FuseLicense

What is FuseLicense?
Well, FuseLicense is a license API that is based on the .

Documentation
Before you can use the API, you need a private and public key. You can generate them .
You can use cURL or other conventional methods to send the POST data to the API Server.

The API Server will be

Adding A New License Code
To do that, you can send these POST data to the API. Of course, you need your private key.
array(
'cmd' => 'fuselicense' //The API you want to have contact with.
'action' => 'new_license' //Give a command to add a new license.
'private_key' => $private_key //Please replace $private_key with your private key.
);

If the process is a success, the server will return a $string of the license code. Be sure to store that license code somewhere.
If the process is a failure, the server will return a $string of "false". Lower-case.

Checking If The License Code Is Correct
To do that, you can send these POST data to the API. Of course, you need the license code.
array(
'cmd' => 'fuselicense' //The API you want to have contact with.
'action' => 'check_license' //Give a command to check the license code given.
'license_key' => $license_code //Please replace $license_code with the license code given when using "new_license"
);

If the process is a success, the server will return a $string of "true". Lower-case.
If the process is a failure, the server will return a $string of "false". Lower-case.

Reference Class
If you have no idea what is going on, you can download the class file below as a reference. All is coded in PHP.
Download: [ ]

Hope you will find this simple script useful. More features will be added in the future.
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
Look's awesome!
Thanks! I'll improve it frequently.

I doubt you guys understand what i wrote anyway. So I added a download link to a class to let you guys know what i'm about. It's fairly-commented though.
 

SupaPenguin

Member
May 15, 2012
103
17
Thanks! I'll improve it frequently.

I doubt you guys understand what i wrote anyway. So I added a download link to a class to let you guys know what i'm about. It's fairly-commented though.
If I'm honest I didn't.

But I thought it was cool when I played with it haha.
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
For those who don't know how to use this and how to implement it to your project or w/e you can use this:
PHP:
<?php
    // Get the Fuselicense Library
    require_once('fuselicenselib.php');
 
    // Create a new instance of fuse_license
    $license = new fuse_license('PRIVATE KEY'); // replace with your private key
 
    // Echo it out so you can try it out in the form
    echo $license->addLicense();
 
    // Check if the button is submitted.
    if(isset($_POST['checklicense'])) {
        // Check if the value in textbox is a valid license
        if($license->checkLicense($_POST['license']) === TRUE) {
            echo "<br />You got it boi! jajajaja";
        } else {
            echo "<br />Nono wrong key, dude!";
        }
    }
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
    <input type="text" name="license" placeholder="License">
    <input type="submit" name="checklicense" value="Check">
</form>
Do NOT use this in production. Of course you would secure your form data and that shizzle. But this is the basic way of how to use the library.
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
This can be used in paid scripts. Hope you guys will use it!
 

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
I can't say I will use it, since I'm all in for OSS but I really like the idea and the API. Recommend it ;P
 

Gajeel

Well-Known Member
Oct 4, 2011
2,411
413
Make a porno site now and use the FuseLicense Library to get paid !! omg omg. You got a cool work and after reading the thread and from few replies, I finally understood what it's meant about.
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
A more documented page is now online! You can learn more about the Hydr API here.
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Yo, I'm currently making a jQuery plugin for FuseLicense - instead of using PHP, we use jQuery!
Now the only problem now is that your server (in the api.php script) uses a wrong header to allow me to retrieve the data via. jsonp and script data.

So if you could either let the api.php return a json object or use the header below, I would be pleased :D
PHP:
header("content-type:application/x-javascript");
- I know it's not that great, when you think about that the private key is exposed, but gotta think this through you no!
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
Yo, I'm currently making a jQuery plugin for FuseLicense - instead of using PHP, we use jQuery!
Now the only problem now is that your server (in the api.php script) uses a wrong header to allow me to retrieve the data via. jsonp and script data.

So if you could either let the api.php return a json object or use the header below, I would be pleased :D
PHP:
header("content-type:application/x-javascript");
- I know it's not that great, when you think about that the private key is exposed, but gotta think this through you no!

I can develop a version for Javascript. But I don't know anything about JSON. Will it be like the original one with teh PHP?
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
First you need to change the header to application/json and just echo json_encode($license) or be more friendly and do;

Code:
$json = array(
'privatekey' => $privatekey, // the private key used
'publickey' => $publickey, // to be really smart (obsolete)
'license' => $license // The license generated
);
 
echo json_encode($json);

Then it will return a json object, which is easier and faster to parse.

And - yes with addlicense and checklicense. The idea was to use AJAX - and yeah, I know you could just make a PHP file and ajax to that n shit, but I thought this was cooler.

I might port the fuselicenselib to another server-side language like Ruby/Ruby on Rails and maybe also for .NET (C#.NET, VB.NET, ASP.NET etc.)
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
First you need to change the header to application/json and just echo json_encode($license) or be more friendly and do;

Code:
$json = array(
'privatekey' => $privatekey, // the private key used
'publickey' => $publickey, // to be really smart (obsolete)
'license' => $license // The license generated
);
 
echo json_encode($json);

Then it will return a json object, which is easier and faster to parse.
So the returned result can just be a string without any line of code or arrays right?
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
The output on the document will be a json object - it looks like an javascript object like:
Code:
{ key: 'value', keyArray: { anotherkey: 'anothervalue' } }
If you get the idea.
It's easier, and faster than XML and the method you're using currently :p
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
The output on the document will be a json object - it looks like an javascript object like:
Code:
{ key: 'value', keyArray: { anotherkey: 'anothervalue' } }
If you get the idea.
It's easier, and faster than XML and the method you're using currently :p

I'm still a little confused. I'll start researching on JSON asap. Then i'll write a documentation on JSON Usage of the FuseLicense API. Thanks for your contribution!
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
No problem. I hope it will be up soon, because I really wan't it as I'm already done with the jQuery plugin - just need this one thing. Otherwise you could do this in the drop over your api.php script:
PHP:
header('Access-Control-Allow-Origin: *');
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
The API has been updated to allow support of JSON. I will update the documentation once Heaplink has tested the API and give a good go.
 
Status
Not open for further replies.

Users who are viewing this thread

Top