Code: Alles auswählen
Parse error: syntax error, unexpected $end in /usr/export/www/hosting/pokestar/forum/gold_function.php on line 338
Code: Alles auswählen
?>
Code: Alles auswählen
<?php
$deaktivate = false;
include("config.php");
// ID
// USERID
// POSTERID
// REASON
// NUMBER
function connect()
{
global $dbhost, $dbuser, $dbpasswd, $dbname;
$conn = mysql_connect("$dbhost","$dbuser","$dbpasswd");
mysql_select_db("$dbname",$conn);
return $conn;
function GetUserList()
{
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "users";
$conn = connect();
$result = mysql_query($sql,$conn);
$list = array();
while ($row = mysql_fetch_row($result))
{
array_push($list,$row[0]);
}
return $list;
}
function GetToplist()
{
$list = array();
$result = "";
$max1 = 0;
$max2 = 0;
$max3 = 0;
$max4 = 0;
$max5 = 0;
$max6 = 0;
$max7 = 0;
$max8 = 0;
$max9 = 0;
$max10 = 0;
$maxu1 = 0;
$maxu2 = 0;
$maxu3 = 0;
$maxu4 = 0;
$maxu5 = 0;
$maxu6 = 0;
$maxu7 = 0;
$maxu8 = 0;
$maxu9 = 0;
$maxu10= 0;
foreach (GetUserList() as $user)
{
if (GetUserGold($user) > $max1)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = $max6;
$max6 = $max5;
$max5 = $max4;
$max4 = $max3;
$max3 = $max2;
$max2 = $max1;
$max1 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $maxu5;
$maxu5 = $maxu4;
$maxu4 = $maxu3;
$maxu3 = $maxu2;
$maxu2 = $maxu1;
$maxu1 = $user;
}
elseif (GetUserGold($user) > $max5)
{
$max10 = $max6;
$max9 = $max5;
$max8 = $max4;
$max7 = $max3;
$max6 = $max2;
$max5 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $maxu5;
$maxu5 = $maxu4;
$maxu4 = $maxu3;
$maxu3 = $maxu4;
$maxu3 = $maxu2;
$maxu2 = $user;
}
elseif (GetUserGold($user) > $max10)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = $max6;
$max6 = $max5;
$max5 = $max4;
$max4 = $max3;
$max3 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $maxu5;
$maxu5 = $maxu4;
$maxu4 = $maxu3;
$maxu3 = $user;
}
elseif (GetUserGold($user) > $max15)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = $max6;
$max6 = $max5;
$max5 = $max4;
$max4 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $maxu5;
$maxu5 = $maxu4;
$maxu4 = $user;
}
elseif (GetUserGold($user) > $max20)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = $max6;
$max6 = $max5;
$max5 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $maxu5;
$maxu5 = $user;
}
elseif (GetUserGold($user) > $max25)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = $max6;
$max6 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $maxu6;
$maxu6 = $user;
}
elseif (GetUserGold($user) > $max30)
{
$max10= $max9;
$max9 = $max8;
$max8 = $max7;
$max7 = GetUserGold($user);
$maxu10= $maxu9;
$maxu9 = $maxu8;
$maxu8 = $maxu7;
$maxu7 = $user;
}
}
$maxi1 = $maxu1;
$maxi2 = $maxu2;
$maxi3 = $maxu3;
$maxi4 = $maxu4;
$maxi5 = $maxu5;
$maxi6 = $maxu6;
$maxi7 = $maxu7;
$maxi8 = $maxu8;
$maxi9 = $maxu9;
$maxi10= $maxu10;
$maxc1 = GetColor($maxu1);
$maxc2 = GetColor($maxu2);
$maxc3 = GetColor($maxu3);
$maxc4 = GetColor($maxu4);
$maxc5 = GetColor($maxu5);
$maxc6 = GetColor($maxu6);
$maxc7 = GetColor($maxu7);
$maxc8 = GetColor($maxu8);
$maxc9 = GetColor($maxu9);
$maxc10= GetColor($maxu10);
$maxu1 = GetName($maxu1);
$maxu2 = GetName($maxu2);
$maxu3 = GetName($maxu3);
$maxu4 = GetName($maxu4);
$maxu5 = GetName($maxu5);
$maxu6 = GetName($maxu6);
$maxu7 = GetName($maxu7);
$maxu8 = GetName($maxu8);
$maxu9 = GetName($maxu9);
$maxu10= GetName($maxu10);
$result = "";
if ($maxu1)
{
$result .= "1. <a href='./bp.php?mode=view&u=$maxi1' class='username-coloured' style='color:#$maxc1;'>" . $maxu1 . "</a> (" . $max1 . ")" . "<br />";
}
if ($maxu2)
{
$result .= "2. <a href='./bp.php?mode=view&u=$maxi2' class='username-coloured' style='color:#$maxc2;'>" . $maxu2 . "</a> (" . $max2 . ")" . "<br />";
}
if ($maxu3)
{
$result .= "3. <a href='./bp.php?mode=view&u=$maxi3' class='username-coloured' style='color:#$maxc3;'>" . $maxu3 . "</a> (" . $max3 . ")" . "<br />";
}
if ($maxu4)
{
$result .= "4. <a href='./bp.php?mode=view&u=$maxi4' class='username-coloured' style='color:#$maxc4;'>" . $maxu4 . "</a> (" . $max4 . ")" . "<br />";
}
if ($maxu5)
{
$result .= "5. <a href='./bp.php?mode=view&u=$maxi5' class='username-coloured' style='color:#$maxc5;'>" . $maxu5 . "</a> (" . $max5 . ")" . "<br />";
}
if ($maxu6)
{
$result .= "6. <a href='./bp.php?mode=view&u=$maxi6' class='username-coloured' style='color:#$maxc6;'>" . $maxu6 . "</a> (" . $max6 . ")" . "<br />";
}
if ($maxu7)
{
$result .= "7. <a href='./bp.php?mode=view&u=$maxi7' class='username-coloured' style='color:#$maxc7;'>" . $maxu7 . "</a> (" . $max7 . ")" . "<br />";
}
if ($maxu8)
{
$result .= "8. <a href='./bp.php?mode=view&u=$maxi8' class='username-coloured' style='color:#$maxc8;'>" . $maxu8 . "</a> (" . $max8 . ")" . "<br />";
}
if ($maxu9)
{
$result .= "9. <a href='./bp.php?mode=view&u=$maxi9' class='username-coloured' style='color:#$maxc9;'>" . $maxu9 . "</a> (" . $max9 . ")" . "<br />";
}
if ($maxu10)
{
$result .= "10. <a href='./bp.php?mode=view&u=$maxi10' class='username-coloured' style='color:#$maxc10;'>" . $maxu10 . "</a> (" . $max10 . ")" . "<br />";
}
if (! $result)
{
$result = "Keine Benutzer auf der Topliste!";
}
return $result;;
}
function GetUserGold($id)
{
$bp = 0;
$sql = "SELECT * FROM phpbb_bp WHERE userid=$id AND editor=0";
$conn = connect();
$result = mysql_query($sql,$conn);
while ($row = mysql_fetch_row($result))
{
$bp += $row[4];
}
return $bp;
}
function GetGold($id)
{
$rs = array();
$sql = "SELECT * FROM phpbb_bp WHERE userid=$id";
$conn = connect();
$result = mysql_query($sql,$conn);
while ($row = mysql_fetch_row($result))
{
array_push($rs,$row);
}
array_reverse($rs);
return $rs;
}
function deleteitem($what)
{
$conn = connect();
$what = (int) $what;
$sql = "UPDATE phpbb_bp SET editor=1 WHERE id=$what";
mysql_query($sql,$conn);
return true;
}
function AddBP($id,$user,$msg,$n)
{
if (! $n) { $n = 0; }
$msg = htmlspecialchars($msg);
$msg = str_replace("ü","ü",$msg);
$msg = str_replace("ä","ä",$msg);
$msg = str_replace("ö","ö",$msg);
$msg = str_replace("Ü","Ü",$msg);
$msg = str_replace("Ä","Ä",$msg);
$msg = str_replace("Ö","Ö",$msg);
$sql = "INSERT INTO phpbb_bp VALUES (NULL,$id,$user,'$msg',$n, '0')";
$conn = connect();
$result = mysql_query($sql,$conn);
if (!$result)
{
return false;
}
return true;
}
function GetColor($id)
{
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "users WHERE user_id=$id";
$conn = connect();
$result = mysql_query($sql,$conn);
$row = mysql_fetch_row($result);
return $row[42];
}
function GetName($id)
{
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "users WHERE user_id=$id";
$conn = connect();
$result = mysql_query($sql,$conn);
$row = mysql_fetch_row($result);
return $row[7];
}
?>