Jump to content

Creating module


Lwks

Recommended Posts

I wan't to creat a new module for whmcs allopass credition but i wan't to know something about whmcs

 

how to credit the loged user example when the client made paiment on site.com/pay1.php he will bi redirect to page payed1.php that have this code

 

<?php

$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file
$username = "Admin"; # Admin username goes here
$password = "demo"; # Admin password goes here

$postfields["action"] = "addcredit";
$postfields["clientid"] = "";
$postfields["description"] = "Adding funds via custom module";
$postfields["amount"] = "1.00";

?>

 

But what i wan't is how to locate the clientid of the ready customer ?

Link to comment
Share on other sites

probably this is what he ment

 

but don't know the exact name of the clientid of the session but you could try this,

 

$postfields["clientid"] = $_SESSION["clientid"];

or

$postfields["clientid"] = $_COOKIE["clientid"];

oh also try this one

$postfields["clientid"] = $_SESSION["uid"];

 

 

 

You could try both not sure if it works though

Edited by laurens_dragicevic
Link to comment
Share on other sites

i Tried <?php

 

$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file

$username = "Admin"; # Admin username goes here

$password = "demo"; # Admin password goes here

 

$postfields["action"] = "addcredit";

$postfields["clientid"] = "2";

$postfields["description"] = "Adding funds via custom module";

$postfields["amount"] = "1.00";

 

?>

 

buts not working why ?

 

do i have to include any files like configuration etc ? to update balance please ?

 

what i need its a simple api who update Client id balance by adding amount

Edited by Lwks
Link to comment
Share on other sites

it could be something like this

 

<?php

$url = "http://www.yourdomain.com/whmcs/includes/api.php"; # URL to WHMCS API file 
$username = "Admin"; # Admin username goes here
$password = "demo"; # Admin password goes here

$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "addcredit";
$postfields["clientid"] = "2";
$postfields["description"] = "Adding funds via custom module";
$postfields["amount"] = "1.00"; 

$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);

$data = explode(";",$data);
foreach ($data AS $temp) {
 $temp = explode("=",$temp);
 $results[$temp[0]] = $temp[1];
}

if ($results["result"]=="success") {
 # Result was OK!
echo "succeed";
} else {
 # An error occured
 echo "The following error occured: ".$results["message"];
}

?>

Edited by laurens_dragicevic
Link to comment
Share on other sites

how to credit the loged user example when the client made paiment on site.com/pay1.php he will bi redirect to page payed1.php that have this code

 

Don't think its a smart idea to make something like this, why? everyone can connect to payed1.php to gain credits even when they have not paid for it, like i can see you don't have alot of knowledge of php to build a safe system. also why do you need to make something like that? you can use whmcs to buy credits.

 

 

but it's possible to make a gift system out of it, which could be awsome :P

 

just a note $_SESSION and $_COOKIE does not work outside domain so you cannot get the clientid,

 

 

not sure if there is a way to get clientid through api

Link to comment
Share on other sites

how to credit the loged user example when the client made paiment on site.com/pay1.php he will bi redirect to page payed1.php that have this code

 

Don't think its a smart idea to make something like this, why? everyone can connect to payed1.php to gain credits even when they have not paid for it, like i can see you don't have alot of knowledge of php to build a safe system. also why do you need to make something like that? you can use whmcs to buy credits.

 

 

but it's possible to make a gift system out of it, which could be awsome :P

 

just a note $_SESSION and $_COOKIE does not work outside domain so you cannot get the clientid,

 

 

not sure if there is a way to get clientid through api

 

i will use a Script protection ;) Don't Crear allopass offer a script like this and wan't i wan't is to made a WHMCS module for allopass to buy credits with allopass

Edited by Lwks
Link to comment
Share on other sites

<?php

 

 

require("dbconnect.php");

require("includes/functions.php");

require("includes/clientareafunctions.php");

require("configuration.php");

 

?>

<?php mysql_query("UPDATE tblclients.serveurs_lwks SET credit =credit + 1 WHERE id = '"$_SESSION['uid']"' "); ?>

 

i tried this but not working :( i don't know what is the required files tried on phpmyadmin works verry well

Edited by Lwks
Link to comment
Share on other sites

UP it work now :D for interested here is the code

 

<?php

 

 

require("dbconnect.php");

require("includes/functions.php");

require("includes/clientareafunctions.php");

require("configuration.php");

 

?>

<?php mysql_query("UPDATE tblclients SET credit =5.00"); ?>

Edited by Lwks
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