<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();

if (get_user_class() >= UC_SYSOP) {
if($_GET['id1']) {
$id4 = sqlesc($_GET[id1]);
mysql_query("DELETE FROM partner WHERE id = $id4");
}
if($_GET['id1']) {
$id5 = sqlesc($_GET[id1]);
mysql_query("DELETE FROM toppartner WHERE id1 = $id5");
}
if($_GET['id1']) {
$id6 = sqlesc($_GET[id1]);
mysql_query("DELETE FROM sponsor WHERE id2 = $id6");
}
}
///////////////////// Neue Funktionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\
if (get_user_class() >= UC_SYSOP) {
if($_GET['pa_name']) {
$pa_name = $_GET['pa_name'];
$pa_banurl = $_GET['pa_banurl'];
$pa_url = $_GET['pa_url'];
$editid = $_GET['editid'];
if ($editid) {
$query = "UPDATE partner SET
titel = '$pa_name',
banner = '$pa_banurl',
link = '$pa_url' where id = $editid";
}
else
{
$query = "INSERT INTO partner SET
titel = '$pa_name',
banner = '$pa_banurl',
link = '$pa_url'";
}
$sql = mysql_query($query);
if($sql) {
$success = TRUE;
} else {
$success = FALSE;
}
}
if($success == TRUE) {
header("Location:  " . $_SERVER['PHP_SELF'] . "");

}
}

///////////////////// Neue Funktionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\
if (get_user_class() >= UC_SYSOP) {
if($_GET['pa_name1']) {
$pa_name1 = $_GET['pa_name1'];
$pa_banurl1 = $_GET['pa_banurl1'];
$pa_url1 = $_GET['pa_url1'];
$editid1 = $_GET['editid1'];
if ($editid1) {
$query = "UPDATE toppartner SET
titel1 = '$pa_name1',
banner1 = '$pa_banurl1',
link1 = '$pa_url1' where id1 = $editid1";
}
else
{
$query = "INSERT INTO toppartner SET
titel1 = '$pa_name1',
banner1 = '$pa_banurl1',
link1 = '$pa_url1'";
}
$sql = mysql_query($query);
if($sql) {
$success = TRUE;
} else {
$success = FALSE;
}
}
if($success == TRUE) {
header("Location:  " . $_SERVER['PHP_SELF'] . "");

}
}

///////////////////// Neue Funktionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\
if (get_user_class() >= UC_SYSOP) {
if($_GET['pa_name2']) {
$pa_name2 = $_GET['pa_name2'];
$pa_banurl2 = $_GET['pa_banurl2'];
$pa_url2 = $_GET['pa_url2'];
$editid2 = $_GET['editid2'];
if ($editid2) {
$query = "UPDATE sponsor SET
titel2 = '$pa_name2',
banner2 = '$pa_banurl2',
link2 = '$pa_url2' where id2 = $editid2";
}
else
{
$query = "INSERT INTO sponsor SET
titel2 = '$pa_name2',
banner2 = '$pa_banurl2',
link2 = '$pa_url2'";
}
$sql = mysql_query($query);
if($sql) {
$success = TRUE;
} else {
$success = FALSE;
}
}
if($success == TRUE) {
header("Location:  " . $_SERVER['PHP_SELF'] . "");

}
}

stdhead("Staff");


if (get_user_class() < UC_MODERATOR)
{
  stdmsg("Sorry...", "Zutritt verweigert!!!");
  stdfoot();
  exit;
}


///////////////////// Neue Optionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\
if (get_user_class() >= UC_SYSOP) {
?>
<table cellpadding="0" cellspacing="0" border="0" style="width:640px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Neuer Partner</center></b></span></td>
 </tr>
<?
print("<br />");
print("<br />");

if ($_GET['editid']) {

$editid = $_GET['editid'];
$query = "SELECT * FROM partner where id = '".$editid."'";
$sql = mysql_query($query);
$row = mysql_fetch_array($sql);
$id = $row['id'];
$tite = $row['titel'];
$banner = $row['banner'];
$url = $row['link'];
}
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=\"tablea\" cellspacing=\"0\" cellpadding=\"5\" width=\"80%\">");
echo("<tr><td>Name vom Partner: </td><td align='left'><input type='text' size='50' value='".$titel."' name='pa_name'/></td></tr>");
echo("<tr><td>Banner-Url: </td><td align='left'><input type='text' size='50' value='$banner' name='pa_banurl'/></td></tr>");
echo("<tr><td>Url zur Seite: </td><td align='left'><input type='text' size='50' value='$url' name='pa_url'/></td></tr>");
echo("<div align='center'><input type='hidden' name='editid' value='$id'/></div>");
echo("<tr><td></td><td><div align='left'><input value='Add' type='submit'/></div></td></tr>");
echo("</table>");
echo("</form>");
}
if (get_user_class() >= UC_SYSOP) {
?>
<table cellpadding="0" cellspacing="0" border="0" style="width:640px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Neuer Top-Partner</center></b></span></td>
 </tr>
<?
print("<br />");
print("<br />");

if ($_GET['editid1']) {

$editid1 = $_GET['editid1'];
$query = "SELECT * FROM toppartner where id1 = '".$editid1."'";
$sql = mysql_query($query);
$row = mysql_fetch_array($sql);
$id1 = $row['id1'];
$titel1 = $row['titel1'];
$banner1 = $row['banner1'];
$url1 = $row['link1'];
}
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=\"tablea\" cellspacing=\"0\" cellpadding=\"5\" width=\"80%\">");
echo("<tr><td>Name Vom Partner: </td><td align='left'><input type='text' size='50' value='".$titel1."' name='pa_name1'/></td></tr>");
echo("<tr><td>Banner-Url: </td><td align='left'><input type='text' size='50' value='$banner1' name='pa_banurl1'/></td></tr>");
echo("<tr><td>Url zur Seite: </td><td align='left'><input type='text' size='50' value='$url1' name='pa_url1'/></td></tr>");
echo("<div align='center'><input type='hidden' name='editid1' value='$id1'/></div>");
echo("<tr><td></td><td><div align='left'><input value='Add' type='submit'/></div></td></tr>");
echo("</table>");
echo("</form>");
}
if (get_user_class() >= UC_SYSOP) {
?>
<table cellpadding="0" cellspacing="0" border="0" style="width:640px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Neuer Sponsor</center></b></span></td>
 </tr>
<?
print("<br />");
print("<br />");

if ($_GET['editid2']) {

$editid2 = $_GET['editid2'];
$query = "SELECT * FROM sponsor where id2 = '".$editid2."'";
$sql = mysql_query($query);
$row = mysql_fetch_array($sql);
$id2 = $row['id2'];
$titel2 = $row['titel2'];
$banner2 = $row['banner2'];
$url2 = $row['link2'];
}
echo("<form name='form1' method='get' action='" . $_SERVER['PHP_SELF'] . "'>");
echo("<table class=\"tablea\" cellspacing=\"0\" cellpadding=\"5\" width=\"80%\">");
echo("<tr><td>Name vom Sponsor: </td><td align='left'><input type='text' size='50' value='".$titel2."' name='pa_name2'/></td></tr>");
echo("<tr><td>Banner-Url: </td><td align='left'><input type='text' size='50' value='$banner2' name='pa_banurl2'/></td></tr>");
echo("<tr><td>Url zur Seite: </td><td align='left'><input type='text' size='50' value='$url2' name='pa_url2'/></td></tr>");
echo("<div align='center'><input type='hidden' name='editid2' value='$id2'/></div>");
echo("<tr><td></td><td><div align='left'><input value='Add' type='submit'/></div></td></tr>");
echo("</table>");
echo("</form>");
}
?>
<br><br><table cellpadding="0" cellspacing="0" border="0" style="width:600px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Partner Tracker</center></b></span></td>
 </tr>
<?
$query = "SELECT * FROM partner";
$sql = mysql_query($query);
while ($row = mysql_fetch_array($sql)) {
$id = $row['id'];
$titel = $row['titel'];
$banner = $row['banner'];
$url = $row['link'];


echo ("<tr><td width=100% class=tablea><br><center><font color=red><font size=3>".$titel."</font></center>
<table width=100% border=0 cellspacing=0 cellpadding=10><tr><td class=text>
<center><a href=".$url." target=_blank><IMG SRC=".$banner."  WIDTH=560 HEIGHT=100 border=0></a></center>
</td><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?editid=$id'><input value='Edit' type='submit'/></a><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?id1=$id'><input value='Delete' type='submit'/></a></div></tr></table><br/>");
}
echo ("</table>");

///////////////////// Neue Optionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\

?>
<br><br><table cellpadding="0" cellspacing="0" border="0" style="width:600px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Top-Partner Tracker</center></b></span></td>
 </tr>
<?
$query = "SELECT * FROM toppartner";
$sql = mysql_query($query);
while ($row = mysql_fetch_array($sql)) {
$id1 = $row['id1'];
$titel1 = $row['titel1'];
$banner1 = $row['banner1'];
$url1 = $row['link1'];

echo ("<tr><td width=100% class=tablea><br><center><font color=red><font size=3>".$titel1."</font></center>
<table width=100% border=0 cellspacing=0 cellpadding=10><tr><td class=text>
<center><a href=".$url1." target=_blank><IMG SRC=".$banner1."  WIDTH=560 HEIGHT=100 border=0></a></center>
</td><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?editid1=$id1'><input value='Edit' type='submit'/></a><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?id1=$id1'><input value='Delete' type='submit'/></a></div></tr></table><br/>");
}
echo ("</table>");
///////////////////// Neue Optionen hinzufügen \\\\\\\\\\\\\\\\\\\\\\\\\\\\

?>
<br><br><table cellpadding="0" cellspacing="0" border="0" style="width:600px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td class="tabletitle" style="padding: 6px;"><b><center>Sponsoren</center></b></span></td>
 </tr>
<?
$query = "SELECT * FROM sponsor";
$sql = mysql_query($query);
while ($row = mysql_fetch_array($sql)) {
$id2 = $row['id2'];
$titel2 = $row['titel2'];
$banner2 = $row['banner2'];
$url2 = $row['link2'];

echo ("<tr><td width=100% class=tablea><br><center><font color=red><font size=3>".$titel2."</font></center>
<table width=100% border=0 cellspacing=0 cellpadding=10><tr><td class=text>
<center><a href=".$url2." target=_blank><IMG SRC=".$banner2."  WIDTH=560 HEIGHT=100 border=0></a></center>
</td><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?editid2=$id2'><input value='Edit' type='submit'/></a><div align='center'><a href='". $_SERVER['PHP_SELF'] . "?id1=$id2'><input value='Delete' type='submit'/></a></div></tr></table><br/>");
}
echo ("</table>");
stdfoot();
?>