Home / Scripts & Code / PHP Scripts / Links


LinkVault Pro - PHP ScriptLinkVault Pro - PHP Script
The perfect solution for earning via your content links. Share your content and earn money.




Home / Scripts & Code / PHP Scripts / Links

LinkVault Pro - PHP Script
The perfect solution for earning via your content links. Share your content and earn money.




2 Support questions or comments
Please login or create an account to post a question or comment.
-
1 week agoLooks like a nice script. Too bad it's not what i am looking for, but comes pretty close.
I need a simple affiliate script, that would track sales on certain pages instead of opened links, with some tracking javascript code. Instead of getting commissions for opened links, the user would get a fixed or variable commission (To be set admin side) on each sale.
Most of the pages would be the same as here, except for the links section / would track sales instead, and a tab in the settings where the user would get his personal affiliate link for a particular domain. On the admin side, the admin would be able to set up multiple domains and automatically get the corresponding tracking script to be added to pages.
This tracking script would then pickup used affiliate links, calculate commissions and display the sales in the user's dashboard. - View 8 more replies
-
1 week agoHi too. Sorry for my abscence. Let's go for PayPal and stripe.
The problem with the refreshing can be easily solved. To guarantee that each PayPal or Stripe payment only generates one commission—and that it’s genuinely settled on the gateway side—you want to shift the moment of “processing” off the user’s browser and into your server, use the gateway’s server-to-server notification (IPN / Webhook), and record every transaction’s unique ID before you ever write out a commission. Here’s the high-level flow:
A[Customer clicks “Pay”] --> B[Redirect to PayPal/Stripe]
B --> C [Customer completes payment]
C --> D [Gateway sends Webhook/IPN to your server]
D --> E [Your server: Validate payload & signature]
E --> F {Is transaction_id already in DB?}
F -- No --> G [Insert transaction_id; calculate & store commission]
F -- Yes --> H [Ignore; already processed]
G --> I [Respond 200 OK to gateway]
H --> I
I --> J [Optionally email/notify admin/user]
Key implementation steps
1. Use Webhooks/IPN rather than trusting page‐refresh
PayPal: configure an IPN listener URL and, upon receipt, validate the IPN message via PayPal’s API before trusting it.
Stripe: configure a webhook endpoint; verify the signature header (Stripe-Signature) with your webhook secret.
2. Persist every transaction ID
Create a table, e.g. processed_payments
CREATE TABLE processed_payments (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
gateway ENUM('paypal','stripe'NOT NULL,
transaction_id VARCHAR(255) NOT NULL,
amount DECIMAL(10,2),
currency CHAR(3),
affiliate_id INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY uq_gateway_txn (gateway, transaction_id)
);
The UNIQUE KEY enforces at most one row per gateway+transaction.
3. And then process it:
<?php
// Example for the Webhook/IPN handler:
// 1. Parse & validate the payload:
$payload = @file_get_contents('php://input';
$isValid = verifyWithGateway($payload, $_SERVER['HTTP_STRIPE_SIGNATURE'] ?? null);
if (! $isValid) {
http_response_code(400);
exit('Invalid signature';
}
$data = json_decode($payload, true);
$txId = $data['id']; // Stripe: “evt.data.object.charges.data[0].id”; PayPal: “txn_id”
$gateway = 'stripe'; // or 'paypal'
$affiliate = lookupAffiliate($data['metadata']['affiliate_code']);
// 2. Attempt to record the transaction:
$db = new PDO(...);
$stmt = $db->prepare("
INSERT IGNORE INTO processed_payments
(gateway, transaction_id, amount, currency, affiliate_id)
VALUES
(:gw, :tx, :amt, :cur, :aff)
";
$stmt->execute([
':gw' => $gateway,
':tx' => $txId,
':amt' => $data['amount'] / 100, // Stripe uses cents
':cur' => strtoupper($data['currency']),
':aff' => $affiliate->id,
]);
if ($stmt->rowCount() > 0) {
// Row was inserted => commission hasn't been paid yet.
payCommission($affiliate, $data['amount'] / 100);
}
// else: duplicate, so we do nothing.
// 3. Acknowledge to gateway
http_response_code(200);
echo 'OK';
?>
4. The INSERT IGNORE (or equivalent “upsert”) plus checking rowCount() makes the logic idempotent: only the first webhook inserts and triggers payCommission().
5. Keep your redirect page “dumb”
Your “thank you” page should not calculate commissions; it simply shows a receipt. All actual processing happens in step 2, safe from user refresh tricks.
ALL IN ALL
+ Server‐to‐server validation means you can’t fake a payment by refreshing or spoofing parameters.
+ Unique index guarantees one‐time processing.
+ Code handles duplicate webhooks gracefully (PayPal/IPN may retry).
With this pattern, once a transaction has been recorded in your processed_payments table, no amount of page-refreshing or re-submitting will create extra commissions. -
1 week agoNextMAS AuthorAbsolutely. Thanks.
-
1 week agoNo problem. Feel free to ask.
-
4 weeks agositeco PurchasedHi. config.php file missing for install. -- Warning: require_once(config.php): Failed to open stream: No such file or directory. Thanks
- View 3 more replies
-
4 weeks agositeco PurchasedI did it for a 4th time and still the same warning. Thank you
-
4 weeks agoNextMAS AuthorOkay. Can you check personal message on codester.
I have shared you the config file. -
1 week agoIs the config file now in the final package?
Information
Category | Scripts & Code / PHP Scripts / Links |
First release | 30 April 2025 |
Last update | 30 April 2025 |
Software version | PHP 8.1, PHP 8.2, PHP 8.3 |
Files included | .php, .css, .sql, Javascript .js |
Tags | management, protection, ads, organization, links, earning |