Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Recommend it Mod - Netscape errors and URLencode

Quote Reply
Recommend it Mod - Netscape errors and URLencode
Hi all,

I am using Robert's recommend it mod for Links SQL. It works great with MSIE, but now with NS. In NS, the description is passed without the fillers for spaces. I have heard that I need to "URLEncode" anything where a space may appear when I am using "GET."

What sort of code do I need to add to make this work?

Thanks.

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
UUUps; Thank you for the message; the problem is that netscape (i hate it really, time for Billy to buy this [bleep!] program) cant do something like:

http://www.test.com/cgi-bin/blabla.cgi?ID=12&Name= one and another word

But he could do:
http://www.test.com/cgi-bin/blabla.cgi?ID=12&Name= oneandanotherword


So easiest thing is to drop the title :-(
Sorry, i dont know what i should do with this; maybe it needs some char before and after the expression; but i dont know which one and dont know if ms could understand this, too.

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
I have tested some things; you cant come with netscape to the script; so the thing must corrected before; hope that there is something for "blabla blabla" the value given with the variable.

I will do now some tests with altavista.com ...

... ok, seems it must be the plus: wordone+wordtwo

But know i have another problem; there must be a routine inside links given out all >Name< as word1+word2+word3

But for this you need another tag parsed to the link.html; cause i wont have it inside the name-tag.

Hmmm ... i think and hope pugdog heave an answer for this :-)

Robert


Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
I also did some research and you're right, something needs to put the "+" sign in between if there is more than one word. Even if I dropped the description, I would still lose anything more than the first word of the title from Netscape users.

PugGod? :)

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
Ok. Hope this would fix it:
Open nph_build.cgi and search for:

# If we are spanning pages

under this you find three times:

$OUT{links} .= &site_html_link ($tmp);

Here the variables are passed to the link.html; first time for index.html when spanning pages; second time, if not spanning pages; third time when writing all pages after page 1 (=index.html)

OVER! this you write:

##--## Recommend Netscape Addon - Setze Titel nach $a; dann ersetze alle Spaces durch + und gib an Recommend als Tag in link.html aus.

my $a = $tmp->{'Title'};
$a =~ s/ \b/+/g;
$tmp->{'Recommend'}.= $a;
##--##

Description:
1. Make a new var $a and set it to the value of the field Title (cause we are in a loop this would be done for every links in your db.)
2. Set $a to: s means substitute space to plus s/ /+/
and do this for ALL Spaces s/ /+/g
3. Set the new value of $a to the new TAG <%Recommend%>

Now you need to substitute <%Titel%> with <%Recommend%> in Link.html (Dont substitute the <%Titel%> for you Link; only the one in the Recommend or Error-Report-Mod; something like:
...TT=<%Recommend%> instead TT=<%Titel%>

Now you need in the birdcast-script the other way to show the link without the +:

Somewhere before the line:
<a href="http://www.yoururl-to-jump.cgi/jump.cgi?ID=$fields{'ID'} target="_new">$fields{'TT'}</a>

do:
$fields{'TT'} =~ s/\+\b/ /g;

Here we need an additional \ bevore the +

I have insert it directly in the main after the &decode_vars;

Ok; Suggestions from the cracks are welcome :-)
One day (maybe 2137) i will learn perl.
Robert

See the whole mod at: http://www.adeva.de/links.htm
Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
You are catching on quick Robert!

That looks like it will work (until it's tried, you never know though).

For what it's worth, the "url" portion of the data string (anything to the left of the "?" needs to have spaces put as " ". The "data" portion of the url, (anything to the right of the ?) needs to have the spaces coded as "+".

If you need a "+" to the right of the data string, you need to escape it, and code it as + (I think that's the code).

I have a table of URL special characters somewhere, I think I got it from one of the PHP books.

I haven't looked at your mod to see why you'd need to do this though.

If you are passing data from inside a <FORM> tag, though, the browser will properly encode the data for you.

I posted a refer-it program that uses all Links <%tags%> to pass data, you might want to look at it make the changes to yours to do the same. Basically, I pass the LinkID to the refer-it program, and it takes the rest of the data out of the Links table, and the user input, so the "raw" data is never encoded into the URL (except by the browser).





http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
You are right, if i could program i would get the data from the db with the recommend or error-report.cgi;
So i must only send the ID and not the whole data like i do it with my mod; so my html-text is much more longer
(eg: <a href="http://..../error.ci?ID=123&URL=http://.....&TT=This is a very long Title")
Cause im no programmer (but wait, i have written my first small program this morning:-)
i have learned to do so many things with links without changing the inner code of the scripts.
Cause of Netscape cant do something like <a href="http://.../error.cgi?ID=word1 word2 and cause of i wont use any forms;
i must do the rewrite of Title by substituting all spaces tru +.

In the error.cgi; that writes and links the Title it must be done again in the other direction.
I have tested it in my intranet; it works.

Robert
Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
Check out:

http://www.postcards.com/...QL/Detailed/183.html

for how I did it. It should be pretty clear, since I tried to comment it as best as I could.

The thread on it is here:

http://gossamer-threads.com/...ew=&sb=&vc=1

And, the results are in the last 3-4 messages (it's a long thread)


http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
Pug,

Your script works great. One thing... is it possible to put in my links.html file:

Times Recommended: <%Recommended%>

How can I have this tag become active?

Thanks.

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
Hi Pugdog,

Never mind... <%Recommended%> works. However, all of my fields are set at nothing (not even a 0) right now, as I guess I created the field without setting a default value until later. How can I set the value of the Recommended field to 0 for all links in my database?

Thanks.

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
You can either delete the field, and re-create it with the default of '0' or you can:

UPDATE Links SET Recommended='0';

This should do it. I you want to preserve non-zero or null values:

UPDATE Links SET Recommended='0' WHERE Recommended='';


http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
PugDog,

Thanks, but I got the following reply:

Rows affected: 0

It didn't seem to work. Any idea why?

Quote Reply
Re: Recommend it Mod - Netscape errors and URLencode In reply to
Make sure the field name is the same as the field in your table. Otherwise, it should work.

The only reason it might not, is that your fields are not 'null' (empty) and you had already set them to '0' or some other value. Check them.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/