1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

AIM and PHP: maybe I'll have better luck here...

Discussion in 'Software Development' started by mussavcom, Apr 18, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    None of the other forums I post on could help me with this, but I'll give it a try here.

    You may be familiar with SubProfile. It's a free software & server where users can create "subprofiles," which have subpages the user makes, like jokes, etc., guestbooks, and visitor logs, to name a few features. You place a link to your SubProfile site in your AIM profile. The link is set up so it opens in the Get Info window, and so it links to something like:

    subprofile.com/v.php?userid=23236235235&nick=%n

    AIM automatically replaces the %n with the person's AIM screen name, so the link would be like:

    ...&nick=myscreenname

    I created a PHP page hosted on my server which I link to in my AIM profile. It has a visitor log much like SubProfile's,. Now, the %n thing works if the user's screenname is only one word--that is, no spaces. If his/her sn is something like "my screen name," however, the user will get an "error loading content" message when he/she click the link. SubProfile somehow found a way around this, because theirs works. Do any of you happen to know what I could do?

    Thanks.
     
  2. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
  3. Snake~eyes

    Snake~eyes

    Joined:
    Apr 18, 2002
    Messages:
    640
    I understand what you're trying to do but not the error you're getting.
     
  4. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    If you click on a link in AIM that has a space, like

    http://google.com/search?q=asdf fdsa

    and set the target to _self so it opens in the Get Info window, it will load for half a second and then show:

    Error Loading Content

    Somehow SubProfile gets around this... I can't figure out how. Anything I try with a space doesn't work. People suggested encoding my URLS and stuff, but it doesn't even get my page, I don't think--it just bombs immediately.
     
  5. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    This is kind of repeating from that other forum..

    You said aim uses %n as the screen name argument.

    A space is encoded as %20

    If a screen name = My Screen Name

    then %n = My%20Screen%20Name

    Perhaps the percent signs are confusing your php script although they should not if you are just grabbingthe variable.

    Aim might use + instead of %20.

    So if you have php file like

    http://www.mysite.com/aim.php?nickname=%n and put it in the additional info for your profile and Bobby Joe45 gets your info and clicks on the link, then it would load

    http://www.mysite.com/aim.php?nickname=Bobby Joe45

    or possibly

    Bobby+Joe45

    So check your php script, to make sure it's grabbing the entire part. Create a screen name with spaces in it to test with.

    How can you have a screen name with spaces though?

    If you signup as bingo 123four , it will auto change it to bingo123four on registration.

    I've never seen an aim screen name with a space in it.

    You can format your screen name to add a space in it. (at least in opengaim), but the %s variable does not store the space.
     
  6. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    No, actually, the %n variable does display the space, too, which means it displays it in the URL. So there's no %20 and no +, just a space:

    http://www.mysite.com/aim.php?nickname=Bobby Joe45

    Now, from here, SubProfile and all the rest have done something, I don't know what, to prevent an error from occurring. I don't think it has anything to do with the PHP, although I could be mistaken, because it seems that any page with a space in it will not load in AIM.

    Perhaps something in the Apache config that must be changed to change the URL before it gets to the script?

    I seriously have no idea, this is very weird.
     
  7. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
  8. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    are you just typing the URI in the more info box for your profile?

    like just typing

    http://www.mysite.com/aim.php?nickname=%s

    or are you clicking on the link next to the smiley to create a new link.

    You should be doing the latter.

    It will ask you to input the URI and input the uri text.

    If you do it like that, then spaces in the screen names should not be a problem.


    See if you just type

    http://www.mysite.com/aim.php?nickname=1 2

    aim will make just

    http://www.mysite.com/aim.php?nickname=1

    the link and the space and 2 will be text.

    Same thing will happen if %s was there and the %s got replaced by a 2 part name.

    However, if you use the link function to create a new link, it should work.

    so if %s = bob charley, bob charley (along with the first part of the uri) will be sent to your browser. Your browser will then encode boy charley to bob%20charley.

    If it still doesn't work, then you can post the php part that grabs the nickname variable and we can see if that's O.K.

    How do you get a 2 part screen name though?
     
  9. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    First, it's got nothing to do with my browser--like I said before, it opens the site in the AIM Get Info window like all the other profiles. So it doesn't encode it, it just makes it

    http://abc.com/p.php?n=he llo

    Second, yes, I do the link button thing to enter the address.

    Third, I don't think it has anything to do with "the php part that grabs the nickname variable" because it doesn't even seem to load the PHP part, it will just display the default AIM error message, and I think that's because it can't go to a URL with a space in it. It doesn't matter that the space is in a variable.

    Fourth, to make a space in your screenname, click My Aim, Edit Options, then Format Screen Name. Then, if you add a space (or more than one space), %n will be replaced with the username, including the space(s).
     
  10. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    I formatted my screen name to add a space. %n still took the space out.

    I noticed there was a new version of aim, so I updated it and the %n kept the space.

    So we are on the same speed there now.

    Now if I GetInfo on somebody in my list to check out their profile, any links in the personal profile box I click on, will open in my default browser. How do you get them do open in aim? (You said it has nothing to do with my browser and it loads in aim)

    All the link does is load in my default browser and my browser changes the space to %20 just like any good browser does.

    If I right-click on the link in the personal profile and click "show hyperlink" it will show the URI with the space as a space and not %20.

    So far I don't see anything wrong with Aim.
     
  11. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    Instead of making a link, I do what SubProfile makes its users do: copy this code and paste it into AIM:

    <a href="http://thelink.com/page.php?n=%n" target="_self">Link</a>

    (You have to copy it from here and paste it into something like NotePad or even your browser's address bar; then copy it from there, and paste it into your profile. Otherwise, just copying it from here, I think, will display the code in your profile, and not make it a link.)
     
  12. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    ok, I see what you mean.

    Now I'll see what I can figure out.

    edit:

    The problem is definitely with aim not converting or keeping the space as %20 when using target="_self" . It's not just a problem with the %n though.

    Put these 2 URIs in the profile to test with.

    <a href="http://home.tbbs.net/shadow/operaforum/test%20cases/401trans.html" target="_self">Link</a>

    <a href="http://home.tbbs.net/shadow/operaforum/test cases/401trans.html" target="_self">Link</a>

    The first one will work, but the second one won't.

    Aim should convert the space between test and cases so that it can complete the URI. Aim is not capable of handling the space when using target="_self". If you use a regular link and click on it, it will work right, but that's not what you want to do.

    However, there maybe another way of inputing the URI into the profile so that aim can handle it. I'll still be looking for a way.

    For now, you should offer 2 links in your profile.

    One with target="_self" and then a regular link that opens in the persons default browser.

    So if the one doesn't work, they can use the regular link.

    I personally would rather have it open in my browser anyways.

    These things you know though.
     
  13. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    Thanks! If you run into anything else that doesn't make sense (other than the whole thing, of course :D) let me know.
     
  14. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    I consider the problem to be a bug.

    Formatting the screen name should not change the %n value.

    Formatting the screen name doesn't actually change your screen name anyway. It's just for display purposes. (Well it's supposed to be anyway)

    If you are joebob and format it as joe bob, people are still IMing you at joebob, it just shows up differently, but it really hasn't changed.

    Now what they could do is keep %n as the nickname and have %f to show the formatted screen name, which could be the same as %n if the person didn't format their screen name.

    Once aim is fixed for that, you can rely on %n to not contain spaces and you are all set. No sense in logging a person's formatted screen name anyway.

    However, aim still needs to be fixed to handle spaces in your situation.

    You could submit a report at the aim site.
     
  15. mussavcom

    mussavcom Thread Starter

    Joined:
    Mar 28, 2004
    Messages:
    51
    Thanks for taking the time to try to help me. As I've said before, SubProfile formats the link exactly the same way, so they've done something about it other than modifying the link, although I have no idea what. Is it possible they did something in their Apache config or elsewhere on the server that "helped" AIM get its request in?
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/221743

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice