<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16609" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>It was a long day yesterday and
I failed to notice the 'obvious'!</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Base64 breaks 8 bit bytes into 6 bit chunks
and uses the '=' padding character to make up the shortfall when the number of
characters encoded is not exactly divisible by 3. I had added leading zeros to
my record ID to make it 4 digits thus '==' would always be added to the
end. 4 digits was just an arbitrary figure so increasing it to 6 solved the
problem!</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Thanks to everyone who offered a
suggestion</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Roger</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV> </DIV>
<DIV style="FONT: 10pt arial">----- Original Message -----
<DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A
title=rp272@cam.ac.uk href="mailto:rp272@cam.ac.uk">Roger Price</A> </DIV>
<DIV><B>To:</B> <A title=fx.php_list@mail.iviking.org
href="mailto:fx.php_list@mail.iviking.org">FX.php Discussion List</A> </DIV>
<DIV><B>Sent:</B> Tuesday, March 04, 2008 7:12 PM</DIV>
<DIV><B>Subject:</B> Re: [FX.php List] [OFF] sending email
confirmation</DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT face="Courier New" size=2>Thank you for all your suggestions. It
seems that it is a well known problem for which UTF-7 Modified Base64 was
developed which does not use the '='.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The '=' is a padding character which only
appears at the end of an encoded string and then only as a single or double. I
tried replacing it with other characters inc '_' but OE still ignored
them.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Finally I did a str_replace' exchanging '='
with ';1' and '==' with ';2'. Having a digit as the last character seems to fool
OE. I haven't yet tried it with Entouage but I expect it will be fine. The code
I used was:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2>if(substr($hash,-2,2)=='==') {$hash =
str_replace('==',';2',$hash);}<BR>if(substr($hash,-1,1)=='=') {$hash =
str_replace('==',';1',$hash);}</FONT></DIV>
<DIV>
<P><FONT face="Courier New" size=2>where $hash was the original base64 encoded
'recid'</FONT></P>
<P><FONT face="Courier New" size=2>This can of course be easily reversed on the
target page. It is not a very elegant solution but works well enough.</FONT></P>
<P><FONT face="Courier New" size=2>Roger</FONT></P></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>----- Original Message ----- </FONT></DIV>
<DIV>
<DIV><FONT face="Courier New" size=2>From: "Chris Hansen" <</FONT><A
href="mailto:chris@iViking.org"><FONT face="Courier New"
size=2>chris@iViking.org</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>To: "FX.php Discussion List" <</FONT><A
href="mailto:fx.php_list@mail.iviking.org"><FONT face="Courier New"
size=2>fx.php_list@mail.iviking.org</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Sent: Tuesday, March 04, 2008 4:46
PM</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Subject: Re: [FX.php List] [OFF] sending
email confirmation</FONT></DIV></DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT></DIV><FONT
face="Courier New" size=2>Roger,<BR><BR>Andrew has the right approach
here. The base64_encode() is great for <BR>encoding things in a way
which makes them not readily recognizable, <BR>but any string that goes
into a url which may have non-alphanumeric <BR>characters in it needs to
be urlencoded. period. This is fundamental <BR>to working with the
web and would even affect putting a text field <BR>into a URL (those
spaces will cause you problems) or comparing one way <BR>hashes. For
more information about encoding, check out the PHP docs:<BR><BR></FONT><A
href="http://us.php.net/manual/en/function.urlencode.php"><FONT
face="Courier New"
size=2>http://us.php.net/manual/en/function.urlencode.php</FONT></A><BR><A
href="http://us.php.net/manual/en/function.rawurlencode.php"><FONT
face="Courier New"
size=2>http://us.php.net/manual/en/function.rawurlencode.php</FONT></A><BR><BR><FONT
face="Courier New" size=2>So most likely what you want to do is first come up
with an <BR>unrecognizable string, and then be sure to urlencode it.
Just one <BR>extra step, and you should be fine. HTH<BR><BR>--Chris
Hansen<BR> FileMaker 8 Certified Developer<BR> FileMaker
7 Certified Developer<BR> Creator of FX.php<BR> "The
best way from FileMaker to the Web."<BR> </FONT><A
href="http://www.iViking.org"><FONT face="Courier New"
size=2>www.iViking.org</FONT></A><BR><BR><FONT face="Courier New" size=2>On Mar
4, 2008, at 8:36 AM, Andrew Denman wrote:<BR><BR>> Roger,<BR>><BR>>
Since the equal sign is a special character for URLs, it is a good
<BR>> idea to not use them in your data if possible. If you must use
the <BR>> equal signs, you should URL encode them to ensure they
work <BR>> everywhere.<BR>><BR>> In FileMaker there is the
GetAsURLEncoded() function, and in PHP <BR>> there is the
rawurlencode() function.<BR>><BR>> Andrew Denman<BR>><BR>> From:
</FONT><A href="mailto:fx.php_list-bounces@mail.iviking.org"><FONT
face="Courier New" size=2>fx.php_list-bounces@mail.iviking.org</FONT></A><FONT
face="Courier New" size=2> [mailto:fx.php_list-bounces@mail.iviking.org <BR>>
] On Behalf Of Steve Winter<BR>> Sent: Tuesday, March 04, 2008 9:15
AM<BR>> To: 'FX.php Discussion List'<BR>> Subject: RE: [FX.php List] [OFF]
sending email confirmation<BR>><BR>> Hi Roger,<BR>><BR>> I presume
that the presence of the two == are a function of <BR>>
base64_encode…?? If not, what purpose do they serve…?<BR>><BR>> Perhaps
using an alternative encoding method (eg md5) might resolve <BR>> the
issue, since it would not result in == characters…??<BR>><BR>>
Cheers<BR>> Steve<BR>><BR>> From: </FONT><A
href="mailto:fx.php_list-bounces@mail.iviking.org"><FONT face="Courier New"
size=2>fx.php_list-bounces@mail.iviking.org</FONT></A><FONT face="Courier New"
size=2> [mailto:fx.php_list-bounces@mail.iviking.org <BR>> ] On Behalf Of
Roger Price<BR>> Sent: 04 March 2008 15:10<BR>> To: FX.php Discussion
List<BR>> Subject: [FX.php List] [OFF] sending email
confirmation<BR>><BR>> As part of a web project I am collecting data from
our some of our <BR>> past students that we have lost contact
with.<BR>><BR>> I want to try to ensure that we don't get too many
malicious returns <BR>> so I intend to send a confirmation to the
entered email address with <BR>> an activation link.<BR>><BR>> So
far so good!<BR>><BR>> In order that the database record key is not
blatantly obvious I'm <BR>> using base64_encode!<BR>><BR>>
however when I mail a link such as: http:// <BR>> </FONT><A
href="http://www.xxx.xxx.xx.xx..edit2.html?rec=MDAwMQ"><FONT face="Courier New"
size=2>www.xxx.xxx.xx.xx..edit2.html?rec=MDAwMQ</FONT></A><FONT
face="Courier New" size=2>==<BR>> the two '=' characters that are generated
at the end of this <BR>> particular record are omitted from the
hyperlink when viewed in <BR>> Outlook Express or Windows Mail.
Entourage only omits one! However <BR>> Outlook and my webmail program
work perfectly.<BR>><BR>> If anybody resolved this problem before I would
be grateful to know <BR>> the best way.<BR>><BR>>
Roger<BR>><BR>><BR>><BR>><BR>><BR>>
_______________________________________________<BR>> FX.php_List mailing
list<BR>> </FONT><A href="mailto:FX.php_List@mail.iviking.org"><FONT
face="Courier New" size=2>FX.php_List@mail.iviking.org</FONT></A><BR><FONT
face="Courier New" size=2>> </FONT><A
href="http://www.iviking.org/mailman/listinfo/fx.php_list"><FONT
face="Courier New"
size=2>http://www.iviking.org/mailman/listinfo/fx.php_list</FONT></A><BR><BR><FONT
face="Courier New"
size=2>_______________________________________________<BR>FX.php_List mailing
list<BR></FONT><A href="mailto:FX.php_List@mail.iviking.org"><FONT
face="Courier New" size=2>FX.php_List@mail.iviking.org</FONT></A><BR><A
href="http://www.iviking.org/mailman/listinfo/fx.php_list"><FONT
face="Courier New"
size=2>http://www.iviking.org/mailman/listinfo/fx.php_list</FONT></A><BR></BODY></HTML>