PERSONALIZED MYSQL SUCCESS PAGE
There are two types of Personalized Success Pages. One, if used with the MySQL database and the other is not dependent upon any database.
This section covers the personalized success page that is dependant on MYSQL as the backend database.
IMPORTANT SECURITY NOTICE: It is not wise to post sensitive information such
as social secuity or credit card numbers on this success page.
Setting up the MYSQL Powered Success Page
To implement this “Success Page Module” you need to add the following field into your HTML form.
<input type="hidden" name="success_page" value="http://www.yourdomain.com/cgi-bin/bmf/mysuccess.cgi?p=1&sql_encrypt_key={sql_encrypt_key}&en_myid={MYSQL_en_id}&SQL_config={SQL_config}">
Breaking it down after the ?
1. p=1
IE: http://www.yourdomain.com/cgi-bin/mysuccess.cgi?p=1
The number after the = sign will be the HTML success page template mysuccess.cgi will use.
(This is configured in the mysuccess.cgi script.)
(AFTER EVERY VARIABLE THERE SHOULD BE AN "&" SIGN THAT WILL PRECEED THE NEXT VARIABLE AS SHOWN IN THE EXAMPLE ABOVE)
2. YOU WOULD THEN ADD: &sql_encrypt_key={sql_encrypt_key}&&en_myid={MYSQL_en_id}&SQL_config={SQL_config}
IE: http://www.yourdomain.com/cgi-bin/bmf/mysuccess.cgi?p=1&sql_encrypt_key={sql_encrypt_key}&en_myid={MYSQL_en_id}&SQL_config={SQL_config}
The config above always needs to appear as is. Adding the line as shown above will dynamicaly retrieve the primary key that is assigned to the record written to MYSQL for this particular form submission, as well as the config needed for MySQL.
IMPORTANT NOTE: If you have read how to configure the default personalized success page, you will notice that we have
not added any steps for personalizing the HTML success page as of yet. This is because no personalization information is passed through the hidden form field "success_page". Instead these values are pulled directly from MYSQL as explained below.
Personalizing the MYSQL Powered Success Page
Personalizing the success page powered by the MYSQL database is not done by interacting with the form, but rather by interacting directly with the MYSQL database. Therefore, the only personalized information that can appear on the success page, is information that has already been written to MYSQL.
As shown above, this information is pulled through the unique primary key that is dynamically passed through the hidden form field: "success_page". Personalizing your success page is quite simple. For every MYSQL field there is a corresponding personalization tag of the same name.
Therefore, if you had the MySQL database structure of:
CREATE TABLE `example_table_name` (
`id` bigint(20) NOT NULL auto_increment,
`crypt_id` varchar(250) NOT NULL default '',
`first_name` varchar(250) NOT NULL default '',
`last_name` varchar(250) NOT NULL default '',
`email` varchar(250) NOT NULL default '',
`phone` varchar(250) NOT NULL default '',
`fax` varchar(250) NOT NULL default '',
`ip` varchar(250) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
You would have 7 possible personalization tags if you where using the MySQL table structure as shown above.
So in this example:
The MYSQL form field `id` corresponds to the personalization tag: <%id%>
`first_name` to <%first_name%>
`last_name` to <%last_name%>
`email` to <%email%>
`phone` to <%phone%>
`fax` to <%fax%>
`ip` to <%ip%>
You can have as many different HTML success page templates as you would like.
The way the mysuccess.cgi script is set up is simple.
1. You either edit the existing mysuccess.html HTML TEMPLATE or create your own HTML success page template.
2. For each HTML TEMPLATE success page that is created you must edit the mysuccess.cgi script to
list all the success pages that you may want to use.
(More documentation is found on this below and in The mysuccess.cgi script.)
3. When you run the mysuccess.cgi page it will access the HTML TEMPLATE success page you specified.
(This is specified through the ?p=[PAGE_NUMBER]
with [PAGE_NUMBER] being replaced by the corresponding page setup in mysuccess.cgi)
4. You can also personalize each HTML TEMPLATE success page. You can read about this ABOVE for more information.
5. ALL YOUR HTML TEMPLATE SUCCESS PAGES should be uploaded into the same directory as the mysuccess.cgi which is usually your cgi-bin.
Variables to Edit in mysuccess.cgi
1. Make sure the top line the "path to Perl" is correct.
ex: #!/usr/bin/perl
If you are not sure, check with either your web host or systems administrator.
2. List all the HTML TEMPLATE success pages you may want to use.
$success_file{"1"} = "mysuccess.html";
$success_file{"2"} = "mysuccess2.html";
$success_file{"3"} = "mysuccess3.html";
$success_file{"1"} refers to HTML TEMPLATE success page that the CGI script mysuccess.cgi
should access. You can use multiple HTML TEMPLATE success pages for multiple forms. To add more HTML TEMPLATE success
pages simply add the line:
$success_file{"2"} = "mysuccess2.html";
-OR-
$success_file{"3"} = "mysuccess3.html";
-OR-
$success_file{"4"} = "success4.html";
AND SO ON..... 5, 6, 7, ETC... Corresponding proportionally
To access this page, simply change the variable used to call the Corresponding PAGE NUMBER SELECTED IN THE URL WHICH IS SET IN THE HIDDEN FORM FIELD "success_page" AS EXPLAINED ABOVE
EXAMPLE: p=1
Set: mysuccess.cgi?p=1
WOULD USE THE SUCCESS HTML TEMPLATE PAGE COFIGURED ON
$success_file{"1"} = "mysuccess.html";
-OR-
ANOTHER EXAMPLE: p=2
Set: mysuccess.cgi?p=2
WOULD USE THE SUCCESS HTML TEMPLATE PAGE COFIGURED ON
$success_file{"2"} = "mysuccess2.html";
-OR-
ANOTHER EXAMPLE: p=3
Set: mysuccess.cgi?p=3
WOULD USE THE SUCCESS HTML TEMPLATE PAGE COFIGURED ON
$success_file{"3"} = "mysuccess2.html";
ETC......
Variables to Edit in sql_settings.cgi
$SQL_encryption_key
This variable implements an important security feature that is used
when the MYSQL powered success page feature is used.
$SQL_encryption_key defines the encryption key for the primary key used.
This feature restricts just anyone from accessing the form results success page.
For security purposes, it is important that the default value
"SQL ENCRYPT KEY" is changed. The value should be between 10-15 Charachters.
Example Config:
$SQL_encryption_key = "MY SECURITY KEY";
Required Form Fields
<input type="hidden" name="sql_primary_key" value="id">
The hidden form field name="sql_primary_key" defines the Unique Primary key of the MYSQL table to which you are writing the from data.
This is only required if you are using the MYSQL powered success page feature.
In the example above, the MYSQL Unique Primary key that is defined is: id
<input type="hidden" name="sql_encrypt_key" value="crypt_id">
The hidden form field name="sql_encrypt_key" defines the encryption key that is generated for the
MYSQL powered success page feature, and is therefore only required
if implementing the described success page feature.
In the example above, the MYSQL field that will store the encryption key is defined as: crypt_id
KEYS TO REMEMBER.
1. The HTML TEMPLATE success pages are not like all the other .html pages.
You MUST upload all of them to the same directory as your mysuccess.cgi page. (This will usually be the cgi-bin)
2. YOU WILL NOT CALL THE mysuccess.html HTML TEMPLATE page.
Rather you will call the mysuccess.cgi page, which in turn calls the mysuccess.html page.
3. The mysuccess.cgi script must be uploaded to a cgi-bin directory and CHOMED to 755.
Permissions 755 is:
Owner: read, write, execute
Group: read, --- , execute
World: read, --- , execute