anpera.net
https://anpera.dyndns.org/phpbb3/

key refund
https://anpera.dyndns.org/phpbb3/viewtopic.php?f=25&t=4394
Seite 1 von 1

Autor:  pandrex [ Sa 15 Mär, 2008 20:14 ]
Betreff des Beitrags:  key refund

I installed the royal estates of anpera, mod that I find fantastic, but I would like to ensure that you can return the keys unwanted, I have tried so but does not work, someone could help me?

Zitat:
}else if ($_GET[op] =="returnkey"){
output("You have decided to return the key of the estate to the owner!");
$sql="SELECT * FROM houses WHERE houseid=".$session[user][housekey]." ";
$result = db_query($sql) or die(db_error(LINK));
$row = db_fetch_assoc($result);
systemmail($row[owner],"`@key returned!`0","`&{$session['user'] ['name']}`2 you returned the key to your house!");
$sql = "UPDATE items SET owner = ".$row[owner]." WHERE owner=".$session[user][acctid]." AND class='key' AND value1=$row[houseid]";
db_query($sql);
addnav("back","houses.php");


Zitat:
addnav("Sonstiges");
$sql="SELECT * FROM houses WHERE houseid=".$session[housekey]." ";
$result = db_query($sql) or die(db_error(LINK));
$row = db_fetch_assoc($result);
if ($row[owner]<>$session[user][acctid])
addnav("key refund","houses.php?op=returnkey");

Autor:  Auric [ So 16 Mär, 2008 10:28 ]
Betreff des Beitrags:  Re: key refund

Hi pandrex,

I think your problem depends on the field "housekey" in the accounts table/$session[user] array.
As far as i know it it just used to identify which house a user owns.
It you want those, who are "guests" in the house, to be able to give back their keys, i would reccomend to find the id of the house using a $session or $_GET variable.

I'm sorry if there might be mistakes... i worked with other house systems the last time and might be confused about then ;-)

Auric

Autor:  pandrex [ So 30 Mär, 2008 15:15 ]
Betreff des Beitrags:  Re: key refund

I have tried in all ways, but I fail to make it work, but I am sure that anpera or eliwood do work in a moment.

Autor:  anpera [ Mo 31 Mär, 2008 11:16 ]
Betreff des Beitrags:  Re: key refund

A script to throw away keys without returning them to the owner can be found here. It makes house owners to think more about who they give a key. If they are not careful they lose a key and have to buy a new one in Hunter's Lodge. ;)

The latest houses.php contains a way for the house owner to take back his keys. (I don't know if it was possible in the english translation.)

For the more friendly habitants of LoGD who want to give back unwanted keys, it is the best to do it by item ID - just in case that there are more than one keys to a house.
The easiest (not the best) way for this is to give the item ID of the key and the ID of the house through the nav.

Example:
All keys that give access to other's houses are listet in navs and can be returned. This would work as a separate script as well and doesn't have to be put into houses.php. I recommend not to enable users to give back keys while they are guests in the house.
$this->bbcode_second_pass_code('', '...
// get all guest keys of the user for all houses
$row=db_query('SELECT * FROM items WHERE class="key" AND owner='.$session['user']['acctid'].' AND value1<>'.$session['user']['house'].' ORDER BY value1');
// generate navs to return guest keys
addnav("Return key");
y=db_num_rows($row);
for (x=0;x<y;x++){
$item=db_fetch_assoc($row);
addnav("for house ".$item['value1'],"xy.php?op=returnkey&itemid=".$item['id']."&houseid=".$item['value']); // not the best way to 'show' those values in the navs!
}
...')
$this->bbcode_second_pass_code('', '...
}elseif ($_GET['op']=="returnkey"){
// return selected key to house owner
$house=db_fetch_assoc(db_query('SELECT owner FROM houses WHERE houseid='.(int)$_GET['houseid']));
db_query('UPDATE items SET owner='.$house['owner'].' WHERE id='.(int)$_GET['itemid']) or die(db_error(LINK));
}
...')
(Not optimized, not tested!
Replace class="key" by class="Schlüssel" for German version.)

Did this help you?

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/