Closed GoogleCodeExporter closed 9 years ago
how would i change this to select the current selected realm?
if (isset($_POST['realm'])) {
$db1 = $DBS[$_POST['realm']];
$user['cur_selected_realmd'] doesnt work.
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 3:35
would it be:
$db1 = $CHDB;
???
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 3:40
$user['cur_selected_realmd'] should work, because in index.php is:
if ((int)$MW->getConfig->generic_values->realm_info->multirealm &&
isset($_REQUEST
['changerealm_to'])){
setcookie("cur_selected_realmd", intval($_REQUEST['changerealm_to']), time()+
(3600*24)); // expire in 24 hour
$user['cur_selected_realmd'] = intval($_REQUEST['changerealm_to']);
}elseif ((int)$MW->getConfig->generic_values->realm_info->multirealm && isset
($_COOKIE['cur_selected_realmd'])){
$user['cur_selected_realmd'] = intval($_COOKIE['cur_selected_realmd']);
}else{
$user['cur_selected_realmd'] = $MW->getConfig->generic_values->realm_info-
>default_realm_id;
}
Which should set $user['cur_selected_realmd'] to either the default realm or
the
currently selected realm.
Original comment by ionstorm66
on 17 Feb 2010 at 3:50
Try "intval($_COOKIE['cur_selected_realmd']);"
Original comment by ionstorm66
on 17 Feb 2010 at 3:57
works...i just get a "could not connect"
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 4:51
[deleted comment]
I think the way to do it is, add another function like this:
$account_check = check_account($name, $user['id']);
if ($account_check == -1) {
echo "<p align='center'><font color='red'>" . $character_1 . $name .
$doesnt_belong_to_account .
"</font></p>";
exit();
}
and the function looks like this:
function check_account($name,$user['id'],$db)
{
change_db($db);
$account_check = "SELECT `name` FROM `characters` WHERE `account` LIKE '$user['id']'";
$check= (then it checks to see if the submitted character name ($name) is matched up
to the account id ($user['id']))
{
$row=mysql_fetch_array($check);
$status=$row['account'];
if ($status == $user['id'])
return 1;
else
return 0;
}else
return -1;
}
something like that i dont know. Seem you know what your doing Ionstorm :D ...
can
you write something like that? I suck at functions.
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 5:07
I dont know, ive been messing with this thing for 4 hours and still cant get
it. can
you give it a go Ionstorm?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 5:14
ok i will look into it.
Original comment by ionstorm66
on 17 Feb 2010 at 5:22
why have a realm select? why not just get the current realm?
Original comment by ionstorm66
on 17 Feb 2010 at 5:42
well thats what ive been trying to do, but if i take the realm selecter away,
then i
cant get it to work
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 5:45
will this help you at all?
something like this?
$db1 = $DB->selectCell("SELECT id FROM `realmlist` WHERE
id=?d",$user['cur_selected_realmd']);
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 6:07
I am still working on a fix. My intenet is being very slow so it is taking a
while.
Original comment by ionstorm66
on 17 Feb 2010 at 6:55
I found why $user['cur_selected_realmd'] wasn't working.
$user['cur_selected_realmd'] =
$MW->getConfig->generic_values->realm_info->default_realm_id;
should be
$user['cur_selected_realmd'] = (int)$MW->getConfig->generic_values->realm_info-
>default_realm_id;
Original comment by ionstorm66
on 17 Feb 2010 at 7:15
where at exactly is this line?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 7:22
I am getting ready to commit the fixed index.php so it will set the cookie and
$user['cur_selected_realmd'] correctly.
Original comment by ionstorm66
on 17 Feb 2010 at 7:23
sounds good :)
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 7:32
There r56 fixed the cookie issue and now character renames are locked to the
current
realm.
Original comment by ionstorm66
on 17 Feb 2010 at 7:44
The character doesnt rename the character. i think this is why:
in "./compnents/account/acount.manage.php" you have:
$db1 = $DBS[$_POST['realm']]
and in "./templates/offlike/account/account.manage.php" you have:
<option value='" . $DBS[$user['cur_selected_realmd']]['id'] . "'>" .
$DBS[$user['cur_selected_realmd']]['name'] .
so shouldnt ". $DBS[$user['cur_selected_realmd']]['id'] ." be
"$DBS[$_POST['realm']]"?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 8:00
or $db1 = $DBS[$user['cur_selected_realmd']]['id']?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 8:01
[deleted comment]
In this part of the code $user['cur_selected_realmd'], $_POST['realm'], and
$DBS[$user['cur_selected_realmd']]['id'] are the same. $DBS is an array of
database
arrarys like this:
Array
(
[1] => Array
(
[id] => 1
[name] => Realm_Name1
[port] => port1
[server] => serverhost1
[dbinfo] => 0
[db] => characters_db1
[mysql_host] => host1
[mysql_user] => someuser1
[mysql_pass] => somepass1
)
[2] => Array
(
[id] => 2
[name] => Realm_Name2
[port] => port2
[server] => serverhost2
[dbinfo] => 0
[db] => characters_db2
[mysql_host] => host2
[mysql_user] => someuser2
[mysql_pass] => somepass2
)
)
Original comment by ionstorm66
on 17 Feb 2010 at 8:32
I see now... At ny rate though, for some reason it wont change the name.. and it
doesnt give an error code or nothing.
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 8:40
Do you think the
"./components/account/chartools/('functiontransfer.php','functionrename.php')"
needs
to be re-wrote with your new code?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 8:48
cant we do something much more simple for password change? like for example,
use the
same code as changing the password in account managment:
$newpass = trim( $_POST['new_pass'] ) ;
if ( strlen( $newpass ) > 3 )
{
$DB->query( "UPDATE account SET sha_pass_hash=? WHERE id=?", $sha_pass,
$user['id'] ) ;
have it some thing like this:
if ($_POST['rename']);
{
$change_name = $CHDB->query( "UPDATE `characters` SET `name`= '$newname' WHERE
`name`
LIKE '$name'";
}
instead of having all those other files and the difficulty of it all?
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 9:35
[deleted comment]
* i meant character re-name not password change*
I also for got to add this after that query:
mysql_query($change_name) or die (mysql_error());
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 9:38
I found the fix: in "./components/account/chartools/functionrename.php" after
reverting back to revision 53, just added this line of code: "UPDATE
`characters` SET
`name`= '$newname' WHERE `name` LIKE '$name' AND `account` = '$account_id'"
And this added to: "./components/account/account.manage.php"
$account_id = $user['id'];
I tested this code out myself over and over and works everytime.
Original comment by wilson.steven10@gmail.com
on 17 Feb 2010 at 10:40
Original issue reported on code.google.com by
wilson.steven10@gmail.com
on 17 Feb 2010 at 3:21