Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need script to add to url to click link on page

    Ok ...
    I am actually working on a Phpbb forum for members of an online game I play.
    I am trying to make custom BBcode tags to access things in my game with no success!

    Here is the thing ...
    In this game, there are players and tribes (groups of players).
    I am unable to link to the player/tribe pages directly with a url using the names because the database and pages for them are linked by numbers.
    ie: each player/tribe name corresponds to a database entry number and you can only use numbers in the URL.
    example:
    Player: Powrpak
    URL: http://en23.tribalwars.net/page.php?...yer&id=3833804
    please note the id=3833804 ..

    soooooo....

    In trying to work a way around this, here is what I can think of ...


    I have found a page that will bring up a player info screen I can use!
    http://www.twstats.com/en23/index.ph...string=Powrpak
    All I do is edit the last variable (searchstring=)with the player name!

    Same with the tribe info screen.
    http://www.twstats.com/en23/index.ph...chstring=EKC 3
    I just edit the same variable in this one as well

    Here is the problem ...
    Hopefull there is an option using a script in the URL . . .


    If you go to either of these pages, you will see it has found the requested info ..
    To GO to the info, you need to click the link with the name of what you searched for.
    I need to make a URL with scripting in it to not only GO to this url listed above
    but hopefully click the link on the page FOR the player/tribe I searched for!!

    I dont know the coding but here is my thoughts . . .
    The player name variable used in the link itself might be the key I would think.
    If you can make the script search the page for a link with the same variable and click that then that solves the problem!
    ie: Player name searched for was "Powrpak" so have the script look for a link named "Powrpak" on the page loaded and click it!

    Any help with this would be GREATLY appreciated!!

    You can test it using the following variables:
    Players: Powrpak / DrgonWhere / Missfit69
    Tribes: EKC 3 / PLG / EKC3-1
    If they all work then we have a solution!!
    Last edited by Powrpak; 06-03-2009 at 04:03 PM.

  • #2
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    umm ... I know this might be asking alot ...
    BUT . . .

    If the above is possible ...
    Is it possible to link through 3 pages??

    Ie: the script itself goes to the link I provided above . . .
    THEN it clicks the link to go to the actual info page for the player/tribe. . .
    THEN it clicks the link on THAT page called "TW.Net"

    I'm thinking this is probably too much to ask and isnt possible!
    BUT .. If it is, I will be a very happy camper .. lol
    Because THAT page is the one I have needed to get to all along .. hehehe

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Umm .. no-one has any ideas or can at least tell me if it's possible??

  • #4
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Starting to wonder if there is any point posting in this forum??

    If it isnt possible, at least someone could post THTA!!

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    You posted on *SUNDAY* (at least here in the USA). When relatively few people are active.

    Anyway, pardon me, but if you have the source code for this game (and you must, if it's written in standard PHP, no?), why not simply change the code in that page you noted:
    http://en23.tribalwars.net/guest.php?screen=info_player&id=3833804

    Fix it so that it will accept a name instead:
    http://en23.tribalwars.net/guest.php?screen=info_player&name=EKC+3

    Just change the PHP code so that it looks for id and, if not found, looks for name and then makes the DB query using name instead of id.

    Almost surely not more than 3 to 5 lines of PHP code would need changing.

    Much simpler than trying to fix it with workarounds in JS code.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    Hmmm...is it possible that this BB of yours is *NOT* on the same server as the game?? That is, you aren't really able to change the PHP code because it's not your server and not your code?

    If so, then maybe the best way to do this is to "screen scrape" using that page you noted.

    That is, you make an AJAX-style request of that page and it returns the full HTML of that page and then you look inside that HTML for the needed id number and then make the actual request using the number.

    Yeah...that doesn't look too hard to do.

    If you look at that page
    http://www.twstats.com/en23/index.php?page=rankings&searchstring=Powrpak
    and do a VIEW-->>SOURCE of the HTML, you will see this line:
    Code:
    <a href="index.php?page=player&amp;id=3833804">Powrpak</a>
    SO it wouldn't be hard at all to get the HTML and look through it for that pattern and pull out the id= value.

    The only caveat here is that this twstats.com fellow may block requests that aren't coming from browsers. Even that's probably not too hard to bypass, by making sure you set the right REQUEST parameters when you make the AJAX-style request.

    I'd imagine you could get this working in one to three hours of work. Unless there is something unexpected that crops up.

  • #7
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok ...
    The first option given is not available to me as I dont have access to the code and,no, the forum is not on same server as the game!

    Second option would require ALOT more skill then I have .. lol
    At least I am honest!!

    How about this . . .
    There is a page I can go to that has a form!
    I will post the source of the page!
    Can someone fix me a link that will go to that page and input the form data and hit submit!!
    This would likely be alot easier!!

    Here is the key source from the page!
    Code:
    <form action="/game.php?screen=ranking&amp;mode=player&amp;search" method="post">
    Search: <input name="name" type="text" value="" size="20" />
    <input type="submit" value="OK" />
    Here is the Page address:
    (You cant likely access it as you must be a player and logged in for the link to work)
    http://en23.tribalwars.net/game.php?screen=ranking&mode=player

    Like I said .. if I can get a URL that will go to this address, insert the form data and submit it .. I AM SET!!
    Sorry to be a pain but I have to find some way around this!
    Last edited by Powrpak; 06-13-2009 at 10:17 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •