PHP and hiveware_enkoder (continued)

Posted by Pierre Igot in: Technology
November 29th, 2004 • 5:52 am

Last Friday, I wrote about a problem I was having when trying to use anti-spam scripts generated by the Hivewave Enkoder service in PHP pages for one of my web sites.

A reader was kind enough to offer to have a look at the scripts, and came back with the conclusion that there was indeed some strings of characters in some of the scripts generated by the Enkoder form that interfered with PHP parsing. More specifically, he said:

By default PHP will consider either <?php or just <? to be the start of a code block. This is a violation of how processing instructions are supposed to work, to my knowledge, but that’s never stopped anyone from bending rules to save a little time.

He offered a couple of possible work-arounds, including outputting the scripts as PHP strings, or saving the scripts in external files rather than within the PHP pages, with only a reference to the scripts in the PHP page itself:

<script type="text/javascript" 
src="enkoder.js"></script>

That’s probably what I’ll end up doing in the future. Right now, the scripts I have don’t seem to interfere with PHP, but of course I might encounter the problem again in the future.

Many thanks to J. King!


Comments are closed.

Leave a Reply

Comments are closed.