Mobile app version of vmapp.org
Login or Join
Kaufman445

: How to implement a software trial request form? On my company's website I want to have a form where a visitor can provide an email address and pass an anti-bot challenge. The server would

@Kaufman445

Posted in: #Database #Email #Forms #Html #Mysql

On my company's website I want to have a form where a visitor can provide an email address and pass an anti-bot challenge. The server would then email a trial key to the visitor.

Background: I am integrating a third-party software licensing solution into my PC software products. This enables users to use a key of the form "1234-56789-ABCDE-F0123" to activate a limited demo version of my software. Unfortunately, I could not find a licensing vendor offering a simple online service to deliver trial keys via email so I am planning to roll my own such service.

When a user submits an email address it is checked against a list of stored addresses. If he has registered before, his previous key is resent. If the email address is new, a fresh trial key is sent out from a preloaded list of, say, 1000 keys. All data (contact info and keys) must be stored securely and there needs to be a basic maintenance portal allowing manipulation and of the database. Other functionality may follow (e.g. multiple demo versions, capturing more than email address from form).

This is the only dynamic page on my website - everything else is pretty much static HTML. What is a good way to implement this behaviour on low cost / ubiquitous hosting (e.g. MySQL, cPanel, etc.)? What platform/language/CMS/services should I leverage?

I may hire someone to write scripts, etc. but I first need direction on which platform I should look at. Many thanks.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman445

2 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

Set a DB with "key", "status", and "client" fields.
Search the client email in the DB
If exists, send the asociated key
Else, query the DB looking for the first key with status "not activated" or something like that and echo it.


form.php
Just a normal form with email and submit. Should use method POST to validate.php

validate.php

<?php
$dbhost = $host; //Use a require file to load your data or replace this ones
$dbname = $base; //
$dbuname = $user; //
$dbpass = $pass; //
$email = $POST_["email"];
$TableName = "keys";
$Link = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuname, $dbpass);
$Query = "SELECT * FROM $TableName WHERE email LIKE $email";
$Result = $Link->query($Query);
if (!$Result) {
$Query = "SELECT * FROM $TableName WHERE status LIKE 'inactive' LIMIT 1";
$Result = $Link->query($Query);
echo $row[key];
} else {
while ($row = $Result->fetch(PDO::FETCH_ASSOC)) {
echo $row[key];
}
}
?>


You probably should add another exception in case there is no keys left and also complete the PHP code in the validate.php (right now it just echoes the keys).

10% popularity Vote Up Vote Down


 

@Gretchen104

Hosting with cPanel, MySQL and PHPMyAdmin (which gives you access to the backend of the database(s)) should be sufficient. Any web scripting language could do what you want, so it may be best to let the person you hire choose. PHP is an obvious choice, and when you want something changed it's likely you could find someone else to help you if the original person isn't even available.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme