The new $p tag

If you have anything to say - or advice to give - on the creation or publishing of ManiaLinks, here is the place to do it!

Moderator: TM-Patrol

Post Reply
Xymph
Pit Crew
Pit Crew
Posts: 5751
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

The new $p tag

Post by Xymph » 02 May 2008 17:30

I've seen very little exposure of this so far, but there's a new $p ManiaLink tag in Forever. I found it buried on the very last subpage (about Text styles) of Smurf's ML overview. The $p tag works like an internal link tag, $h, but expects a script that should return a ManiaLink. Also, the $p tag passes some player information to the script which can be used: the login, nickname, language and location.

For instance, this tag:

Code: Select all

$p[http://link/to/script.php]Get Player Info$p
will call the script like this:

Code: Select all

http://link/to/script.php?playerlogin=<login>&lang=<language>&nickname=<nickname>&path=<location>
At its very basic, an example PHP script to return a ManiaLink can look like this:

Code: Select all

<?php
echo '<manialink>';
echo '<line><cell><text>'. $_GET["playerlogin"] .'</text></cell></line>';
echo '<line><cell><text>'. $_GET["nickname"] .'</text></cell></line>';
echo '<line><cell><text>'. $_GET["lang"] .'</text></cell></line>';
echo '<line><cell><text>'. $_GET["path"] .'</text></cell></line>';
echo '</manialink>';
?>
I've added some info about the $p tag to the Nickname Formatting and ManiaLink Page Wikis.

One problem: it appears the game client is caching the output from the script, because when even after you change e.g. the formatting of the ManiaLink that is returned, requesting it again will show the previous layout. Restarting the game client refreshes it to the new format, but it is time consuming to tweak the ML output this way.

Hope this is useful to some people.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: The new $p tag

Post by f*ckfish » 02 May 2008 20:34

Thanks a lot, will try to integrate that tag into the ColorParser soon, at least as a normal link or so...
Xymph wrote:...One problem: it appears the game client is caching the output from the script, because when even after you change e.g. the formatting of the ManiaLink that is returned, requesting it again will show the previous layout. Restarting the game client refreshes it to the new format, but it is time consuming to tweak the ML output this way...
Does it also happen if you set <timeout>0</timeout> (I think that was the right syntax) From what I heard this is the ManiaLink equivalent to the HTML cache headers.
inactive, sorry

Xymph
Pit Crew
Pit Crew
Posts: 5751
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: The new $p tag

Post by Xymph » 02 May 2008 21:15

f*ckfish wrote:
Xymph wrote:...One problem: it appears the game client is caching the output from the script, because when even after you change e.g. the formatting of the ManiaLink that is returned, requesting it again will show the previous layout. Restarting the game client refreshes it to the new format, but it is time consuming to tweak the ML output this way...
Does it also happen if you set <timeout>0</timeout> (I think that was the right syntax) From what I heard this is the ManiaLink equivalent to the HTML cache headers.
Ah, good point, had forgotten about that. Adding it to the ManiaLink that's output by the example script will indeed make the game client follow layout changes upon every request. Thanks for the reminder. :thumbsup:
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
FT»Marcel
cyclist
cyclist
Posts: 44
Joined: 18 Mar 2008 12:07
Owned TM-games: All
Manialink(s): Marcel, FunTrackers
Location: Thuringia, Germany
Contact:

Re: The new $p tag

Post by FT»Marcel » 06 May 2008 06:28

I think you should mention, that this method of authentificaton is not very save. This data can be manipulated very easy (or easyly, easily... damn English xD): You only have to type the url in the top line for your own, and so you can enter any data you want.
So $p alone is not possible to protect critical areas, such like admin panel (if somebody want to have one ^^), at least you'll need a password request or something like that ;)

Xymph
Pit Crew
Pit Crew
Posts: 5751
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: The new $p tag

Post by Xymph » 06 May 2008 08:48

FT»Marcel wrote:I think you should mention, that this method of authentificaton is not very save. This data can be manipulated very easy (or easyly, easily... damn English xD): You only have to type the url in the top line for your own, and so you can enter any data you want.
So $p alone is not possible to protect critical areas, such like admin panel (if somebody want to have one ^^), at least you'll need a password request or something like that ;)
Good point, but I never considered the $p info to be used for authentication either, only as information into a script.

PS. Easily. :)
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
FT»Marcel
cyclist
cyclist
Posts: 44
Joined: 18 Mar 2008 12:07
Owned TM-games: All
Manialink(s): Marcel, FunTrackers
Location: Thuringia, Germany
Contact:

Re: The new $p tag

Post by FT»Marcel » 06 May 2008 12:14

But it would be great, if these data would be transfered in the background in an array, so you can really identify the current user without a chance of manipulation.
E.g.: You would be able to let download someone a track for free, because he already have downloaded this track, or that special persons always get your skins for free and so on.

Great possibilities, if there would be not the easy manipulation :(

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: The new $p tag

Post by f*ckfish » 06 May 2008 12:31

There's no safe way to transfer the data since you have to capture it on the server side via http/post or http/get. Both of them can be faked easily.
Maybe via cookies or ssl, that would probably be an overkill^^ I dunno and actually I don't think it was intended to serve as a secure identification ;-)
In my eyes it's much better to just identify via password (or community code if you like to) and base your paying/not paying on that information.
inactive, sorry

Post Reply