Gut, alles klar.
Nun zurück zum Button - wie lese ich die USER ID heraus?
So funktioniert es leider nicht ...
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if(!$userdata['session_logged_in'])
{
redirect(append_sid("login.$phpEx?redirect=buildings.$phpEx", true));
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'buildings_body.tpl')
);
/// Auslesen der User ID
$this_userdata = get_userdata($user_id);
$user_id = $this_userdata['user_id'];
///
/// Anweisung zum Updaten der Datenbank
///
if(!empty($buttom)){
echo("Buttom gedrückt");
$db_query = "UPDATE phpbb_users
SET user_posts = user_posts + 4,
user_cash = user_cash - 500,
user_holz = user_holz - 300,
user_stein = user_stein - 500,
user_church = user_church + 1
WHERE user_id = $user_id";
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
.tpl-Datei:
Code: Alles auswählen
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<td class="row1" align="left" width="1%">...
</td><td class="row1" align="left" width="50%"><span class="gensmall">Kirche
</td><td class="row1" align="right" width="50%">
<form name="form1" method="post" action="buildings.php?buttom=1"><input type="submit" name="Buttom" value="Buttom"></td></form>
</tr>
</table>