Trying to port a simple CF script to PHP and just wanted to double-check:
newsletterthanks.cf:
coldfusion code:
<CFPARAM name="URL.response" default="">
<CFPARAM name="URL.emailaddress" default="">
<!--- we should have got back URL.emailaddress (the email address) and URL.response
URL.response will be one of:
addedSuccess = Email successfully added to database
addedSuccessAndEmailed = Email successfully added to database, autoresponse emailed to user.
existsNotAdded = Email is already in the database, no action taken.
removeSuccess = Email successfully removed from database
removeSuccessAndEmailed = Email successfully removed from database, autoresponse emailed to user.
removeFail = Email not found in the list, no action taken.
--->
<CFOUTPUT>
<CFIF URL.response EQ "addedSuccess" or URL.response EQ "addedSuccessAndEmailed">
<p><strong>Thankyou for subscribing to our newsletter!</strong></p>
<p>
You subscribed using the address: <CFIF isDefined("URL.emailaddress")>#URL.emailaddress#<CFELSE>[not returned]</CFIF>
</p>
<CFELSEIF URL.response EQ "existsNotAdded">
<p><strong>You are already subscribed to our newsletter!</strong></p>
<p>
You are already subscribed using the address: <CFIF isDefined("URL.emailaddress")>#URL.emailaddress#<CFELSE>[not returned]</CFIF>. No action has been taken.
</p>
<CFELSEIF URL.response EQ "removeSuccess" or URL.response EQ "removeSuccessAndEmailed">
<p><strong>You have been unsubscribed from our newsletter!</strong></p>
<p>
Your address<CFIF isDefined("URL.emailaddress")>, #URL.emailaddress#</CFIF> has been removed from our list.
</p>
<CFELSEIF URL.response EQ "removeFail">
<p><strong>We don't know you!</strong></p>
<p>
Your address<CFIF isDefined("URL.emailaddress")>, #URL.emailaddress#</CFIF> does not appear on our list. No action has been taken.
</p>
<CFELSE>
<p><strong>Unknown response - this shouldn't ever happen</strong></p>
</CFIF>
<p>
DEBUG: The list server said: <CFIF isDefined("URL.response")>#URL.response#<CFELSE>[not returned]</CFIF>
</p>
</CFOUTPUT>
newslettererror.cf:
coldfusion code:
<CFPARAM name="URL.error" default="">
<CFPARAM name="URL.emailaddress" default="">
<!--- we should get URL.error and URL.emailaddress
URL.error should be one of:
err1 = *NOT ACTIVE* - script accessed with incorrect method (i.e called directly instead of POST action)
err2 = missing/blank List ID
err3 = non-valid List ID
err4 = missing/blank email address
err5 = non-valid email address (per email validation rules defined)
err6 = subscriber limit reached
err7 = invalid request type
err8 = no response URL
--->
<p><strong>There was an error subscribing you to our newsletter!</strong></p>
<CFOUTPUT>
<p>
Your attempted to subscribe <CFIF isDefined("URL.emailaddress")>using the address #URL.emailaddress#</CFIF> unfortunately failed.
</p>
<p>
Debug: The list server gave this error code: <CFIF isDefined("URL.error")>#URL.error#<CFELSE>[not returned]</CFIF>
</p>
</CFOUTPUT>
Those URL.etc variables are just equivalent to $_POST['etc'] right? And everything else is just a standard if (..) { } else if (..) { } type structure, yep?
EDITED: 15 Oct 2006 00:35 by ANDY