View Full Version : Ampersand in Username
July 1st, 2011, 04:07 PM
Hi, I have just noticed on my Photopost that usernames that contain an ampersand are being changed to &amp;
See here: Photoshop Brushes - Tea Stains 2 | Digiscrap Forum Product Gallery (http://www.digiscrapforum.com/products/brushes/p378-photoshop-brushestea-stains-2)
I did a search but nothing I found seems to fit my particular problem lol
I have the vbulletin features turned on for the template only (headers, footers and styles), not the advanced features for the editor etc
July 1st, 2011, 05:05 PM
Please give me an example. I see nowhere in our code that we are adding anything to a username. We simply grab the username as it appears in your vb database.
What is the actual username in your database?
July 1st, 2011, 05:12 PM
On the link I posted Chuck if you scroll down to see the username you can see what I mean, I just checked the database and it is entered there as Creative Victorian & Netta Riss so I guess PP is adding the extra amp; to the url link and display?
July 1st, 2011, 05:24 PM
Your gallery was closed so remember I could not see anything which is why I asked
Maybe try in showphoto.php this code
if ( $phuavatar && $Globals['showavatar'] == "yes" )
$phuavatar = htmlspecialchars( $photouser ) . "<br /><br />$phuavatar";
$phuavatar = htmlspecialchars( $photouser );
change it to this
if ( $phuavatar && $Globals['showavatar'] == "yes" )
$phuavatar = "$photouser<br /><br />$phuavatar";
$phuavatar = $photouser;
July 1st, 2011, 05:27 PM
Sorry Chuck, I closed it for 10 minutes while I upgraded since I just realised there were newer files lol it's open now....off to try that change and will let you know if it works :)
July 1st, 2011, 05:30 PM
That took away the extra amp; but it is still displaying the & instead of just &
July 1st, 2011, 11:37 PM
well instead of what I told you before how about just changing htmlspecialchars with un_htmlspecialchars
July 2nd, 2011, 12:07 AM
Perfect! Thanx so much Chuck :) The url still shows the old link, would there be a way to clear that so it can show the url correctly now?
July 2nd, 2011, 11:20 AM
we have not been discussing urls so not sure what your referring to our discussion here has been about a username display issue.
July 2nd, 2011, 04:35 PM
I'm sorry, I thought it was ok to ask about a related issue..
On the page I linked the url shows as Member Profile | Digiscrap Forum Product Gallery (http://www.digiscrapforum.com/products/m167-creative-victorian26amp-3bamp-3b-netta-riss)
yet on the front page in the most recent box the url still shows as Member Profile | Digiscrap Forum Product Gallery (http://www.digiscrapforum.com/products/m167-creative-victorian26amp-3b-netta-riss)
Both links lead to the same place, there are no errors in that but I don't want duplicate content either
I would have thought with changing the display the url would have adjusted too, the way the image url does if you edit the title .. all I wanted to know is if there is a way to clear that so it can "rewrite" the url.
July 2nd, 2011, 05:15 PM
It is fine to ask about another issue you just need to explain some so I know what your referring to. ;)
Well the question I would have is where did you come to the first url from. I see how each link is formed and they are formed by the same function so honestly I do not see how they are different for those actions but you can try in your forums subfolder of your gallery install in the vb3.php file line 432 is this
$User['username'] = $username;
try changing it to this
$User['username'] = un_htmlspecialchars($username);
July 2nd, 2011, 05:29 PM
The first url is from the page I originally linked here Photoshop Brushes - Tea Stains 2 | Digiscrap Forum Product Gallery (http://www.digiscrapforum.com/products/brushes/p378-photoshop-brushestea-stains-2) the username down next to the description box is linked to the profile, and takes the url (seo) from how the username was displayed before your fix. The second url is from the Most Recent box at the top of the front page.
I don't see any difference in your before and after code? *hides* lol
July 2nd, 2011, 05:44 PM
reapply the recommended change.
July 2nd, 2011, 05:54 PM
That didn't make any change, I may be stuck with it lol
July 2nd, 2011, 08:52 PM
I do not see how it would not make a change. Basically we just did the same thing we did for your showphoto script throughout the whole application making the change in the global integration file.
July 2nd, 2011, 09:28 PM
There might be some confusion in what I mean, I'm sorry Chuck
The display now is fine from your first fix, it's the way the url is being written...the seo here coverted my links so you might have missed what I meant:
Show Photo Page: [GALLERY_HOME_LINK]/m167-creative-victorian26amp-3bamp-3b-netta-riss
Front Page: [GALLERY_HOME_LINK]/m167-creative-victorian26amp-3b-netta-riss
See how those two url's are being written differently? That's what I'd like to change, maybe I need to do a db search and just replace :)
July 2nd, 2011, 10:28 PM
I know what your saying. what I am saying is your issue is with an & being in the username whereas you can see my first fix basically added un_htmlspecialchars to the showphoto which fixed the file. My next suggestion basically does what we did in showphoto to the entire application.
You can try in pp-inc.php line 2437
$string = strtolower( htmlspecialchars( $string ) );
change to this
$string = strtolower( un_htmlspecialchars( $string ) );
July 3rd, 2011, 12:03 AM
Unfortunately that still didn't fix the actual url, however I tried adding the two new replaces at the end here in pp_inc:
$str1 = array('Ä', 'ä', 'Ü', 'ü', 'Ö', 'ö', 'ß', '(', ')', '[', ']', ' | ', '&', 'amp;');
$str2 = array('Ae', 'ae', 'Ue', 'ue', 'Oe', 'oe', 'ss', '', '', '', '', '-', 'and', '');
which now gives the nice url m167-creative-victorian-and-netta-riss on the url links, I had to add the second amp; as it still displayed wrong on the showphoto page while being just right on the front page....so far I can't see that this has adversely affected any other section of the gallery but I will keep my eyes open and look around :)
Thanx for all your help Chuck :D
July 3rd, 2011, 08:41 AM
Okay no problem
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.