View Full Version : a few questions about user ids in battle.php
Chief Corn
03-16-2005, 10:25 PM
our battles are set to public and i'm sure logging into battles is determined by user id, so is there any reason for the password field when creating a battle? i was thinking of just making it a hidden input type. but if people were to view the source of the page and retrieve for example value="nopassword" would they be able to login? if i was to remove it completely from the form would it process correctly?
and in the browse battles page i'm trying to get the user ids. what i'm trying to do is make the user's names in the battles in progress a link so when you click it it opens rpg.php?userid= in a pop up window showing their stats.
Revan
03-17-2005, 07:07 AM
The password function, at the best of my imagination at the time of writing this, used for added security. URL/form spoofs are always a risk, so there's no reason why it can't be in there.
I believe removing it would mean heavy altering of the battle files (possibly all 3 of them), and template changes.
You are welcome to attempt this yourself, but be warned; I cannot provide support for errors caused of modifications to the code for obvious reasons. Always make backups :)
I believe you can use $owner[userid] and $opponent[userid] to generate links out of their respective names (which is which is easy to spot in the template).
I have to wonder, why would you want to generate such links, when all stats displayed in the rpg.php (apart from Battle Statistics) are displayed in the battle template itself?
If there's a valid reason for this, I would consider adding it to the next version, see ;)
Chief Corn
03-17-2005, 08:02 AM
the password deal i'll play around with it a bit. i just want one less thing to fill out.
this is the rpg_battle_browsemiddle template. those were the ones i used in the template but they don't output anything. if you could picture what's happening in this html, it's trying to make the names clickable so you could compare the challengers and opponents stats with a click.
<tr><td align="center"><b>$row[battlenumber]</b> </td>
<td width="20%" align="center"><a href="http://www.treethugs.com/forum/rpg.php?userid=$owner[userid]" onclick="window.open('http://www.treethugs.com/forum/rpg.php?userid=$owner[userid]','popup','width=300,height=290,scrollbars=no,resi zable=no,toolbar=no,directories=no,location=no,men ubar=no,status=no,left=50,top=50'); return false">$row[owner]</a> </td>
<td width="20%" align="center"><a href="http://www.treethugs.com/forum/rpg.php?userid=$opponent[userid]" onclick="window.open('http://www.treethugs.com/forum/rpg.php?userid=$opponent[userid]','popup','width=300,height=290,scrollbars=no,resi zable=no,toolbar=no,directories=no,location=no,men ubar=no,status=no,left=50,top=50'); return false">$row[opponent]</a> </td>
<td width="20%" align="center">$gamestate </td>
<td width="20%" align="center">$$row[wager] </td>
<td width="20%" align="center">$turn </td>
<td width="20" align="center"><a href="battlefight.php?do=enterbattle&battlenumber=$row[battlenumber]">view</a></td>
</tr>
the reason i want to be able to see the stats of challengers and opponents is to make it easier for my users on who to bet on the battles used in conjunction with the hack vBookie. i'll make that a suggestion after you get your rpg hack out of beta...for users to be able to bet on the fights. so after creating the battle have it automatically kick out the betting thread (like vBookie if you tried that hack), which would also act as the battle report when it's over. it would make a good pre/post battle conversation. as of right now i'm just doing everything manually, problem is when i'm not around for the battle... i don't know what happened. ;P
you'll also see a few other things i'm trying to add to the battle browse page. like brining the top 10 players on there, settled bookie events, etc. i just can't figure out how to make them show...
the link to see what it is i'm trying to do:
site: http://www.treethugs.com/forum/battle.php?do=browse
user: vBorg
pass: test
Revan
03-17-2005, 08:10 AM
It doesn't work because I assumed you meant inside the battle, not on the browse page.
When I get home (~4h) I'll see about giving you the code to add to be able to fetch the userid of the participants :)
As for the vBookie integration, I have never touched that hack and I don't plan to, so if you can get the stuff working OK you could always release it as an addon here on vBorg :)
Cyricx
03-17-2005, 02:06 PM
O wow, I hadn't even thought of integrating with Vbookie, awesome idea Chief! :)
I hope you'll release it if you get it :)
Revan
03-17-2005, 02:06 PM
use $row[ownerid] and $row[opponentid] to have the JScript work :)
Chief Corn
03-17-2005, 03:04 PM
use $row[ownerid] and $row[opponentid] to have the JScript work :)
weeeeeeee. it works, thank you for that.
i have removed the password field from the form, and as well as from the auto PMs sent. i setup a battle me vs vBorg. then created another test account to see if i could log in as a differnt user with the correct battle # and password, and it didn't work. i also tried the url with the battle # and password, and that didn't login either. so it should be fine since i removed the login and password from the rpg_battle_browse template, unless there's other ways of logging in.
cyricx, well integrating vbookie isn't going to be easiest thing for me to do. :nervous: i don't know php...but i do know how to cut and paste. so it's just trial and error hoping it spits something out to html. i'll release my findings but it won't be the most efficient code... :lick:
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.