ich habe noch ein kleines Problem mit einem Script. Undzwar ist es bei mir so, wenn sich die User anmelden muss man sie manuell freischalten. Aber wenn ich dann auf Akzeptieren drücken will, komme ich immer auf die index.php.
Kann mir einer bitte helfen :S
index.php:
PHP Code:
<?php include('header.php'); ?>
<?PHP
if(isset($_GET['s']) && !empty($_GET['s']))
{
if(file_exists("./pages/".$_GET['s'].".php"))
{
include("./pages/".$_GET['s'].".php");
}
else {
include("./pages/home.php");
}
} else
{
include("./pages/home.php");
}
?>
<?php include('footer.php'); ?>
PHP Code:
<?php if((isset($_SESSION['username']))&&(isset($_SESSION['password']))){ ?>
<?php if (($_SESSION['rank']=='4' || $_SESSION['rank']=='3'))
{
?>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<h1>Anfragen</h1><br><br>
<table style="text-align: left; width: 660px;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center; width: 200px; background-color: rgb(0, 0, 102);"><b>Name</b></td>
<td style="text-align: center; width: 200px; background-color: rgb(0, 0, 102);"><b>Email</b></td>
<td style="text-align: center; width: 202px; background-color: rgb(0, 0, 102);"><b>Bereich</b></td>
<td style="text-align: center; width: 202px; background-color: rgb(0, 0, 102);"><b>?</b></td>
</tr>
</tbody>
</table>
<?php
$quete = mysql_query("SELECT * FROM validation");
while($validation = mysql_fetch_array($quete))
{ ?>
<table style="text-align: left; width: 660px;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center; width: 220px;"><?php echo $validation['pseudo']; ?></td>
<td style="text-align: center; width: 220px;"><?php echo $validation['email']; ?></td>
<td style="text-align: center; width: 220px;"><?php echo '
<a class="content_button" href="index.php?s=usercheck&action=candid&id='.$validation['id'].'">Infos über ihn</a> '; ?></td>
<td style="text-align: center; width: 212px;"><?php echo '
<a class="content_button" href="index.php?s=usercheck&action=accepter&id='.$validation['id'].'">Akzeptieren</a>
<a class="content_button" href="index.php?s=usercheck&action=refuser&id='.$validation['id'].'">Ablehnen</a>'; ?>
</td>
</tr>
</tbody>
</table>
<?php
}
if(isset($_GET['action']) AND isset($_GET['id']))
{
$action = $_GET['action'];
if($action == "accepter")
{
$id = $_GET['id'];
$quete2 = mysql_query("SELECT * FROM validation WHERE id='$id'");
$connexion = mysql_fetch_array($quete2);
$pseudo = $connexion['pseudo'];
$passe = $connexion['passe'];
$email = $connexion['email'];
mysql_query("INSERT INTO membres VALUES ('', '$pseudo', '$passe', '$email', '1')");
echo "<hr /><center><b>".$pseudo." - Mitglied akzeptiert</b></center>";
mysql_query("DELETE FROM validation WHERE id='$id'");
}
elseif($action == "refuser")
{
$id = $_GET['id'];
mysql_query("DELETE FROM validation WHERE id='$id'");
echo "<hr /><center><b>".$pseudo." - Mitglied abgelehnt</b></center>";
}
elseif($action == "candid")
{
$id = $_GET['id'];
$quete3 = mysql_query("SELECT * FROM validation WHERE id='$id'");
$info = mysql_fetch_array($quete3);
$candid = $info['candidature'];
$complement = $info['complement'];
$pseudo1 = $info['pseudo'];
?><br><br>
<table style="text-align: left; width: 660px;" border="0"
cellpadding="0" cellspacing="0">
<tbody>
<tbody>
<tr>
<td style="text-align: center; width: 220px; background-color: rgb(0, 0, 200);"><b>Alles über <?php echo $pseudo1; ?></b></td>
</tr></table><br><center><?php echo $complement; ?></center>
<?php
}
}
?>
<?php }
} ?>
Wenn ich bei einem User was ändern will geht der immer auf index.php?u=1 z.b. aber er soll es so machen index.php?s=blabla&u=1
PHP Code:
<?php
/***********************
* InventorySQL php example
* require .jar version 0.3.2
***********************/
require 'lib/lib.mysql.php';
require 'lib/lib.config.php';
require 'lib/lib.items.php';
$MySQL = new SQL($host, $user, $pass, $database);
$users = $MySQL->execute("SELECT `id`, `owner` FROM `".$table."`");
$data = true;
$inv_totalItems = 0;
$pend_totalItems = 0;
$inventory[] = array();
$pendings[] = array();
$tmp[] = array();
$index = 0;$isError = false;
$message = '';
if(isset($_GET['u'])){
$data = $MySQL->execute("SELECT * FROM `".$table."` WHERE `id`='".$MySQL->escape($_GET['u'])."';");
}else{
$data = $MySQL->execute("SELECT * FROM `".$table."`");
}
if(isset($_POST['give'])) {
if($_POST['item_byte'] == '') $_POST['item_byte'] = 0;
if($_POST['item_count'] == '') $_POST['item_count'] = 1;
if(!is_numeric($_POST['item_id']) || !is_numeric($_POST['item_byte']) || !is_numeric($_POST['item_count'])) { $isError = true; $message = 'Please enter only numbers'; }
$item_id = intval($_POST['item_id']);
$item_byte = intval($_POST['item_byte']);
$item_count = intval($_POST['item_count']);
if($item_id == 0) { $isError = true; $message = 'Cannot give/remove AIR item !'; }
if(!isset($_GET['u']) || !$data) { $isError = true; $message = 'Unknown id'; }
if($item_count > 64) { $isError = true; $message = 'Too many items ! Limit is 64 per stack'; }
if(!$isError) {
$dat = '['.$_POST['item_action'].'('.$item_id.':'.$item_byte.')x'.$item_count.']';
$give = $MySQL->execute("UPDATE `".$table."` SET `pendings`=CONCAT_WS(',',`pendings`,'".$MySQL->escape($dat)."') WHERE `id`='".$MySQL->escape($_GET['u'])."';");
}
}
if(isset($_GET['u'])) {
$data = $MySQL->execute("SELECT * FROM `".$table."` WHERE `id`='".$MySQL->escape($_GET['u'])."';");
foreach (explode(",", $data[0]['inventory']) as $i) {
if($i != '') {
preg_match("/\[([0-9]{1,2})\(([0-9]{1,3}):([0-9]{1,2})\)x(-?[0-9]{1,2})\]/", $i, $matches);
if($matches[2] != '0') {
$inventory[$index] = array('slot' => intval($matches[1]), 'id' => intval($matches[2]), 'byte' => intval($matches[3]), 'number' => intval($matches[4]));
$num = intval($matches[4]);
if ($num > 0) $inv_totalItems += $num;
if ($num < 0) $inv_totalItems += 1;
$index++;
}
}
}
$index = 0;
foreach (explode(",", $data[0]['pendings']) as $i) {
if($i != '') {
preg_match("/\[(-|\+)?\(([0-9]{1,3}):([0-9]{1,2})\)x([0-9]{1,2})\]/", $i, $matches);
if($matches[2] != '0') {
$pendings[$index] = array('param' => $matches[1], 'id' => intval($matches[2]), 'byte' => intval($matches[3]), 'number' => intval($matches[4]));
$num = intval($matches[4]);
if ($num > 0) $pend_totalItems += $num;
if ($num < 0) $pend_totalItems += 1;
$index++;
}
}
}
}
?>
<form action="" method="get">
<fieldset>
<select name="u">
<?php
foreach ($users as $user){
echo '<option value="'.$user['id'].'"';
if(isset($_GET['u'])) if($_GET['u'] == $user['id']) echo 'selected="selected"';
echo '>'.$user['owner'].'</option>';
}
?>
</select>
<input type="submit" value="Change"/>
</fieldset>
</form>
<?php if(isset($_GET['u']))
if($data) { ?>
<h3>Inventory</h3>
<?php
echo $inv_totalItems." items in total<br />";
if($inv_totalItems > 0) {
echo '<ul>';
foreach($inventory as $inv) {
echo '<li><b>Slot '.$inv['slot'].'</b> : '.$items[$inv['id']].':'.$inv['byte'].' (x'.$inv['number'].')';
}
echo '</ul>';
}else{
echo '<i>No items</i>';
}
?>
<h3>Pendings</h3>
<?php
echo $pend_totalItems." items in total<br />";
if($pend_totalItems > 0) {
echo '<ul>';
$txt = '';
foreach($pendings as $pend) {
if($pend['param'] == '+') {
$txt = 'Add';
}elseif($pend['param'] == '-'){
$txt = 'Remove';
}else{
$txt = '(error..)';
}
echo '<li><b>'.$txt.'</b> : '.$items[$pend['id']].':'.$pend['byte'].' (x'.$pend['number'].')';
}
echo '</ul>';
}else{
echo '<i>No items</i>';
}
?>
<form action="" method="post">
<fieldset>
<select name="item_action">
<option value="+">add</option>
<option value="-">remove</option>
</select>
<select name="item_id">
<?php
foreach ($items as $id => $item){
echo '<option value="'.$id.'">'.$item.'</option>';
}
?>
</select>:<input type="text" maxlength="2" name="item_byte" width="2" /> number : <input type="text" maxlength="2" name="item_count" width="2" /><br />
<input type="submit" value="Give" name="give"/> <?php if($isError) echo $message; ?>
</fieldset>
</form>
<?php
}else{
echo "<h2>Unknown id</h2>";
} ?>
Item list for minecraft <?php echo $items_version; ?>