cancel
Showing results for 
Search instead for 
Did you mean: 

~ and acount name in URL

Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

~ and acount name in URL

Does anyone know why I should see a ~ inserted in a URL. I this noted when I looked at tracking info I found:-
00:00:05 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=1
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=4
  00:00:03 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=4
    and visited ccgi.37club.co.uk/~martek/php-bin/37club/index.php
  00:00:10 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=4
    and visited
  00:00:07 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=4
    and visited
please note that  /~martek my account name is now included in the URL, my scripts do NOT call links in this way.
I have looked for info about his on google and found that Drupal uses this in URLs but it can NOT be that as my scripts are hand-written and run as pure PHP.
The tracking breaks after the URL with ~ in it. I am not sure why as the tracking script should log all hits to ccgi.37club.co.uk.
Any advice would be helpful.
10 REPLIES 10
BenTrimble
Plusnet Alumni (retired)
Plusnet Alumni (retired)
Posts: 2,106
Registered: ‎06-02-2008

Re: ~ and acount name in URL

I believe that this is a feature of our CGI server and I don't think that there's a way around it. This isn't my area of expertise though so am ready to be corrected!
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: ~ and acount name in URL

Its strange as it only happens occasionally. Looks like more of a problem than a planned feature to me.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ~ and acount name in URL

The occurrence of /~username in some file paths is associated with the suEXEC security module used on new ccgi. Unfortunately some environment variables, in particular $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME'] include /~username. Hence any URL built up from those environment variables will contain that text.
The solution on ccgi is to change any occurrence of either of those variables to $_SERVER['SCRIPT_URL'] which does not contain the /~username text.
David
oliverb
Grafter
Posts: 606
Registered: ‎02-08-2007

Re: ~ and acount name in URL

Oddly enough I've seen that behavior in a script recently, but it was sporadic, not consistent, and its not happening today. The script in question builds URLs using functions in the perl CGI module (I didn't ask how).
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: ~ and acount name in URL

Quote from: spraxyt
The occurrence of /~username in some file paths is associated with the suEXEC security module used on new ccgi. Unfortunately some environment variables, in particular $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME'] include /~username. Hence any URL built up from those environment variables will contain that text.
The solution on ccgi is to change any occurrence of either of those variables to $_SERVER['SCRIPT_URL'] which does not contain the /~username text.

I am not using any of the $_server variables listed above, I have scanned my code and all I can find is a single $_SERVER['REQUEST_URI'], so am I to take it that any reference to a $_server['whatever'] is likely to randomly put ~username in the URL.
oliverb
Grafter
Posts: 606
Registered: ‎02-08-2007

Re: ~ and acount name in URL

As far as I can tell the only environment variable affected is SCRIPT_NAME.
I've tried two environment-dumps, one in bash and one in perl.
SCRIPT_FILENAME=/files/home3/bungalow0/test.cgi
REQUEST_URI=/test.cgi
SCRIPT_NAME=/~bungalow0/test.cgi
SCRIPT_URI=http://ccgi.boristheengineer.co.uk/test.cgi
HTTP_CONNECTION=Keep-Alive
REMOTE_PORT=1216
PATH=/usr/local/bin:/usr/bin:/bin
SCRIPT_URL=/test.cgi
PWD=/share/storage/01/bu/bungalow0
Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: ~ and acount name in URL

As far as I can tell this is happening at truly random times, I see tracking data where a visitor views many pages without ~martek ever appearing in the URL, at other times its there but not always even in the same viewing session and when the same pages are visited.

This visitor first arrived from www.google.co.uk 37 club puriton 1-10
    and visited www.37club.co.uk/
  00:00:04 later, arrived from www.37club.co.uk/
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=7
  00:00:13 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=7
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=5
  00:00:25 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=5
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=7
  00:00:03 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=7
    and visited ccgi.37club.co.uk/~martek/php-bin/37club/index.php
  00:00:34 later, arrived from ccgi.37club.co.uk/~martek/php-bin/37club/index.php
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=7
  00:00:04 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=7
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=8
  00:01:00 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=8
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=4
  00:00:06 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=4
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=5
  00:02:54 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=5
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=13
  00:00:28 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=13
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=6
  00:00:28 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=6
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=7
  00:00:41 later, arrived from ccgi.37club.co.uk/php-bin/37club/index.php?s=7
    and visited ccgi.37club.co.uk/php-bin/37club/index.php?s=8
As you can see its not happening every time even when the same pages are viewed, the pages are not dynamic so I would have thought they would always appear the same.

zubel
Community Veteran
Posts: 3,793
Thanks: 4
Registered: ‎08-06-2007

Re: ~ and acount name in URL

Sounds like one of the CCGi servers is misbehaving.  I'll flag up for someone to take a peek.
B.
bobpullen
Community Gaffer
Community Gaffer
Posts: 16,869
Thanks: 4,950
Fixes: 315
Registered: ‎04-04-2007

Re: ~ and acount name in URL

Problem 63612 raised or investigation although I'm unable to provide any timescales for resolution at present...
Edit: doesn't look to be a widespread issue. @Marteknet you're using the $SCRIPT_NAME variable in a form on that page.

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵

Marteknet
Grafter
Posts: 577
Registered: ‎13-10-2007

Re: ~ and acount name in URL

Quote from: Bob
Problem 63612 raised or investigation although I'm unable to provide any timescales for resolution at present...
Edit: doesn't look to be a widespread issue. @Marteknet you're using the $SCRIPT_NAME variable in a form on that page.

Yes Thanks Bob, Sorry I don't know how I missed that one. I have now changed it so I hope things will settle down now, I am still curious why having $SCRIPT_NAME in the script didn't cause the ~ to appear every time the script was called.
Bob not related to this issue please read http://community.plus.net/forum/index.php/topic,84740.msg741300.html#msg741300
Regards Peter.