Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jul 2000
Posts: 82
Member
Member
Offline
Joined: Jul 2000
Posts: 82
Here's a convoluted one. When a user that has a space in their user name creates a poll, the URL for the "View the results for this poll" link looks like:
[:blue]http://SaveTheFreeWeb.com/forum/viewpoll.php?Cat=...&poll=988303666Bill Dimm
Note that the space in the user name after the [:blue]poll= has not been converted to a %20 as it should be (spaces aren't legal in a URL). So, when you click the link you end up with empty poll results if you are using Netscape 4.7 while it looks just fine in Opera (which apparently converts the space automatically). The same problem also occurs when you click the "Submit vote" button for the poll and it attempts to take you to the Poll results page. The problem occurs when viewing the poll in both flat and threaded modes. When you are on the broken viewpoll.php page you can manually fix the URL by changing the space to a %20 and verify that it does then display correctly.

Bill Dimm, MagPortal.com - [:red]free feeds for your site.

Sponsored Links
Joined: May 2000
Posts: 125
Member
Member
Offline
Joined: May 2000
Posts: 125
Adding in showflat an shwothreaded, just after
[:blue]if ($Poll) //(N.B. instances in the script)

the line

$Poll = rawurlencode($Poll);

fixes the bug.


In fact, each time a variable with possible special chars is an argument of a url we need to urlencode it.




Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
Thanks for the info Bill. I'll use the fix from Sharif (thanks Sharif[]/testimages/icons/wink.gif[/]), to patch this up.


UBB.threads Developer
Joined: Oct 2000
Posts: 60
Power User
Power User
Offline
Joined: Oct 2000
Posts: 60
Just curious, but what's the main advantage of using rawurlencode() over urlencode() ?

Administrator, Videogame Music Archive

Joined: Jul 2000
Posts: 82
Member
Member
Offline
Joined: Jul 2000
Posts: 82
Thanks Sharif. It seems there is one other change needed to make it show the results properly after the user casts a vote. In "dopoll.php" the line that says:
[:blue]$ref .="&what=$prog&vc=1&poll=$pollname";
should be changed to
[:blue]$ref .="&what=$prog&vc=1&poll=" . rawurlencode($pollname);

Also, just to clarify your fix - it appears that each file has two if-statements that need to be adjusted. Alternatively, you can can look for the line like:
[:blue]list ($Number,$Posted,$Username..., $Poll, ...) = $dbh -> fetch_array($sth);
and add after it:
[:blue]if ($Poll) { $Poll = rawurlencode($Poll); }

Bill Dimm, SaveTheFreeWeb.com

Sponsored Links
Joined: May 2000
Posts: 125
Member
Member
Offline
Joined: May 2000
Posts: 125
The only thing I can tell you : rawurlencode is safer than urlencode. Variables, like & amp (without space), may match HTML entities and when parsed by the browser, with urlencode, the actual entity is used instead of the variable. I have no idea on the perfomance of the two functions.



Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)