Our website wants to implement a php form that users complete, which then lets them download some software, get emailed a license key and inserts their record into a MySQL database.
My proposed pseudo code is as follows:
function to santize cleanup input data
function to generate a key based on an algorithm (for the purposes of this project, returning a fixed string of '01234567890' is fine)
function to insert firstname, surname, company, email, newsletter optin? and key into database
function to send email
if (action=='submit') {
? ? ? ? cleanup the data to protect against SQL injection and bad characters and error check for format
? ? ? ? generatekey
? ? ? ? insert into database
? ? ? ? sendemail to customer
? ? ? ? show a "thankyou page"
? ? ? ? autodownload the executable
} else {
? ? ? ? < form>
? ? ? ? ? ? ? ? First Name: text
? ? ? ? ? ? ? ? Last Name: text
? ? ? ? ? ? ? ? Company: text
? ? ? ? ? ? ? ? Email Address: text
? ? ? ? ? ? ? ? Newsletter: checkbox
? ? ? ? < / form>
}