I am writing some code to allow users to unsubscribe from our public newsletter. In the (personalized) URL that I send along with the newsletter three parameters are stored:
'act' containing fixed value 'afmelden' (unsubscribe)
'actid' containing a key
'email' containing the email address that is unsubscribing. The key must match the key stored in the database for this email address. If not we will not unsubscribe the user.
The URL looks as follows:
In my code I am trying to catch the act, actid and email parameters.
But I am unsuccessful: nothing is getting through.
Please see below to get a rough idea of how I built up the code of unsubscribe.php. I am getting the params with gpc then displaying them on the screen for debug purposes: nothing is shown.
What am I doing wrong?
'act' containing fixed value 'afmelden' (unsubscribe)
'actid' containing a key
'email' containing the email address that is unsubscribing. The key must match the key stored in the database for this email address. If not we will not unsubscribe the user.
The URL looks as follows:
- Code: Select all
https://www.example.com/tools/unsubscribe.php?act=afmelden&email=mail@example.com&actid=9923hhb89s2
In my code I am trying to catch the act, actid and email parameters.
But I am unsuccessful: nothing is getting through.
Please see below to get a rough idea of how I built up the code of unsubscribe.php. I am getting the params with gpc then displaying them on the screen for debug purposes: nothing is shown.
What am I doing wrong?
- Code: Select all
<cms:if success >
<!-- sorry to see you go message -->
<cms:if success = 'NOK' >
<!-- something went wrong: internal message to manually unsubscribe this user -->
</cms:if>
<cms:else />
<!-- now the real work -->
<cms:set action="<cms:gpc 'act' method='get'/>" />
<cms:set activationid="<cms:gpc 'actid' method='get'/>" />
<cms:set email="<cms:gpc 'email' method='get'/>" />
act: <cms:show action /><br />
actid: <cms:show activationid /><br />
email: <cms:show email /><br />
<cms:if action='unsubscribe' >
<!-- check email and actid, if OK then unsubscribe this user -->
<!-- if all went ok than success = 'OK' otherwise it is 'NOK' -->
<cms:set success = "<cms:show success />" />
<cms:redirect k_page_link />
</cms:if>
</cms:if>