It seems that single quotes and ampersands are legal in {LINKTITLE} but illegal (i.e. cause PHP problems at runtime) when used in custom text linkfields such as {LINKADDRESS} and {LINKCITY}.
Is there a way to make these custom fields accept single quotes, ampersands, or other special characters?? I am curious why the title can contain them....
<IF {LINKFILEFIELD}><br>{LANG_SHOWLINKS_ATTACHED}:<br> <!-- BEGIN LINK ATTACHMENTS --> <a href="download.php?id={LINKID}&attachid={ATTACHID}">{ATTACHFILETITLE}</a> ({ATTACHKB} {LANG_GENERAL_KB}, {ATTACHDOWNLOADS} {LANG_DETAILS_DOWNLOADS})<br> <IF {ATTACHISIMAGE}><a href="download.php?id={LINKID}&attachid={ATTACHID}"><img src="{ATTACHTHUMBURL}" alt="image"></a><br></IF> <!-- END LINK ATTACHMENTS --> </IF>
</td> <!-- END REGULAR LINKS --> </table> </IF>
Anything which displays raw PHP code is a severe server configuration problem which exposes you to hacking. A correct apache should be incapable of exposing your source.
But now I have the same problem if someone enters a double quote in one of those custom fields. This problem does not occur in {LINKTITLE} and {LINKDESCRIPTION}. Is there a function somewhere that changes these quotes into HTML character codes?
addslashes escapes quotes and encodeit replaces them, but I don't see how it'll do you any good in a template. You should probably work with the object directly, $l = new onelink('id', {LINKID}); getmap($l->address, $l->city, $image); despite the extra load time involved.
I didn't set it, it just came that way. Anyhow it ought to work in the current version with magic quotes off, I'm not going require anyone to turn them on.
My php.ini, though, contains
; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = On
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of '). magic_quotes_sybase = Off
0/5
1
2
3
4
5
This thread is closed, so you cannot post a reply.
Comments on Special characters in link field values
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
It seems that single quotes and ampersands are legal in {LINKTITLE} but illegal (i.e. cause PHP problems at runtime) when used in custom text linkfields such as {LINKADDRESS} and {LINKCITY}.
Is there a way to make these custom fields accept single quotes, ampersands, or other special characters?? I am curious why the title can contain them....
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
No such problem, wasted a few minutes creating a test with the first link at www.temp.wsnforum.com/wsnli...snlinks/brand_new_category
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
It looks like you're testing special characters in {LINKDESCRIPTION}...
As I said, my problem has been only with custom text fields that I added.
When I use single quotes or ampersands I get raw PHP code spit out at the top of the page.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
No, the field is named 'test', not 'description'.
Anything which displays raw PHP code is a severe server configuration problem which exposes you to hacking. A correct apache should be incapable of exposing your source.
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
Would you be able to take this on as a paid project... take a look at this problem and see what's wrong with the server....
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
scripts.webmastersite.net/w...dex.php?section=inspection
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
I went back and looked at the PHP code that was printed out, and it was because
$address='{LINKADDRESS}';
$city='{LINKCITY}';
getmap($address, $city, $image);
?>
should be
$address="{LINKADDRESS}";
$city="{LINKCITY}";
getmap($address, $city, $image);
?>
But now I have the same problem if someone enters a double quote in one of those custom fields. This problem does not occur in {LINKTITLE} and {LINKDESCRIPTION}. Is there a function somewhere that changes these quotes into HTML character codes?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
addslashes escapes quotes and encodeit replaces them, but I don't see how it'll do you any good in a template. You should probably work with the object directly,
$l = new onelink('id', {LINKID});
getmap($l->address, $l->city, $image);
despite the extra load time involved.
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
This was fixed when MagicQuotes was turned on.
Nothing is impossible...
Usergroup: Customer
Joined: Aug 07, 2006
Location: Tampa, Florida
Total Topics: 36
Total Comments: 91
Just out of curiousity, where did you set Magic Quotes to ON?
I was in my PHP.INI file and noticed this:
magic_quotes_gpc = Off
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of ').
magic_quotes_sybase = Off
It looks like it is still OFF.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I didn't set it, it just came that way. Anyhow it ought to work in the current version with magic quotes off, I'm not going require anyone to turn them on.
My php.ini, though, contains
magic_quotes_gpc = On
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of ').
magic_quotes_sybase = Off