Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: wob_rank_system image pasalinimas

Parašė House· 2008 Rugs. 15 17:09:32
#8

Cia imeciau Rank_system.php

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";

if (!checkrights("IP")) fallback("../index.php");

if (file_exists(INFUSIONS."wob_rank_system/locale/".$settings['locale'].".php")) {
   include INFUSIONS."wob_rank_system/locale/".$settings['locale'].".php";
} else {
   include INFUSIONS."wob_rank_system/locale/English.php";
}

function getgroups() {
   global $locale;
   $groups_array = array(
   array("102", $locale['user2']),
   array("103", $locale['user3'])
   );
   $gsql = dbquery("SELECT group_id,group_name FROM ".DB_PREFIX."user_groups");
   while ($gdata = dbarray($gsql)) {
      array_push($groups_array, array($gdata['group_id'], $gdata['group_name']));
   }
   return $groups_array;
}


opentable($locale['WRS100']);

if (empty($action)) {$action="def";}
echo '<br>
   <table align="center" class="tbl-border" cellpadding="3" cellspacing="1" width="100%">
   <tr>';

$header = array(
"ranz" => $locale['WRS109'],
"rnamanz" => $locale['WRS110'],
"rupload"=> "Bilder Upload",
"rbild"=> $locale['WRS114'],
"rextra"=> $locale['WRS115'],
"rtest"=> $locale['WRS116']
);

foreach($header as $ac => $title) {
   $tbl = ($ac == $action ? "tbl3" : "tbl2");
   if($ac == $action ){
      echo "<td class='$tbl' width='15%'><center><b>$title</b></center></td>";
   }else{
      echo "<td class='$tbl' width='15%'><center><a href='".FUSION_SELF."?action=$ac'><b>$title</b></a></center></td>";
   }
}

echo '</tr>
   <tr>
      <td align="center" class="tbl1" colspan="6"><br>';

$resultanz = dbquery("SELECT anz FROM ".$db_prefix."forumrang_admin ");
$dataanz = dbarray($resultanz);

switch($action)
{
   ///////////////////////////////////////////
case 'ranz':

   if (isset($_POST['save_rang_anzrang'])) {
      $result = dbquery("UPDATE ".$db_prefix."forumrang_admin  SET anz='".$_POST['anzrang']."' ");
      
      $result = dbquery("DELETE FROM ".$db_prefix."forumrang WHERE id >'".$_POST['anzrang']."'");
      $result = dbquery("DELETE FROM ".$db_prefix."forumrang_bilder WHERE id >'".$_POST['anzrang']."'");
      

      $rowsforumrang = dbcount("(id)", "forumrang");
      for($s=$rowsforumrang+1; $s <= $_POST['anzrang']; $s++){
         $result = dbquery("INSERT INTO ".$db_prefix."forumrang  (id) VALUES ('".$s."') ");
      }
      
      $rowsforumrang_bilder = dbcount("(id)", "forumrang_bilder");
      for($v=$rowsforumrang_bilder+1; $v <= $_POST['anzrang']; $v++){
         $result = dbquery("INSERT INTO ".$db_prefix."forumrang_bilder (id) VALUES ('".$v."')");
      }
      
      header("Location: rank_system.php?action=".$action."");
   }

   echo "<form method='post' action='".$PHP_SELF."?action=".$action."'>
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>";

   echo"<td class='tbl1' width='25%' align='center'>".$locale['WRS118']."<select name='anzrang' class='textbox'>";
   for($c=1;$c <= 30; $c++){
      echo"<option value='".$c."' ".($dataanz['anz'] == "".$c."" ? " selected" : "").">".$c."</option>";
   }
   echo"
</select></td>";
   echo"</tr>";
   echo"
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td align='center' colspan='2'>
<br>
<input type='submit' name='save_rang_anzrang' value='".$locale['WRS105']."' class='button'></td>
</tr>
</table>
</form>\n";   


   break;
   ///////////////////////////////////////////
case 'rnamanz':

   if (isset($_POST['save_rang'])) {
      for($i=1;$i <= $dataanz['anz']; $i++){
         $result = dbquery("UPDATE ".$db_prefix."forumrang  SET posts='".$_POST['post'.$i.'']."', rank='".$_POST['name'.$i.'']."' WHERE id='".$i."'");
      }
      header("Location: rank_system.php?action=".$action."");
   }

   echo "<form method='post' action='".$PHP_SELF."?action=".$action."'>
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS101']."</b></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS102']."</b></td>
<td width='40%' align='left' class='tbl2'></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS103']."</b></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS104']."</b></td>
</tr>\n";
   $t=0;
   $result = dbquery("SELECT * FROM ".$db_prefix."forumrang ORDER BY id ASC");
   while ($data = dbarray($result)) {
      if($t==2){$t=0;}
      $vorher = $data['id'] - 1 ;
      $result2 = dbquery("SELECT * FROM ".$db_prefix."forumrang WHERE id='".$vorher."' ORDER BY id ASC ");
      $data2 = dbarray($result2);
      $data2['posts'] = $data2['posts'] + 1;
      $tbl = ($t == 1 ? "tbl2" : "tbl1");
      echo"
<tr>
<td class='$tbl width='40%' align='left'>".$data['id']."</td>
<td class='$tbl width='40%' align='left'><input type='text' disabled=\"false\"  name='nofunk' value='".$data2['posts']."' class='textbox' style='width:50px;'></td>
<td class='$tbl width='40%' align='left'><b>-</b></td>
<td class='$tbl width='40%' align='left'><input type='text' name='post".$data['id']."' value='".$data['posts']."' class='textbox' style='width:50px;'></td>
<td class='$tbl width='40%' align='left'><input type='text' name='name".$data['id']."' value='".$data['rank']."' class='textbox' style='width:150px;'></td>
</tr>
";
      $t++;
   }

   echo"
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td align='center' colspan='2'>
<br>
<input type='submit' name='save_rang' value='".$locale['WRS105']."' class='button'></td>
</tr>
</table>
</form>\n";
   break;
   ///////////////////////////////////////////      
case 'rbild':
   if (isset($_POST['save_rang_bilder'])) {


      for($i=1;$i <= $dataanz['anz']; $i++){
         $result = dbquery("UPDATE ".$db_prefix."forumrang_bilder SET bild='".$_POST['bild'.$i.'']."', anz='".$_POST['bildanz'.$i.'']."' WHERE id='".$i."'");
      }
      header("Location: rank_system.php?action=".$action."");
   }

   echo "<form method='post' action='".$PHP_SELF."?action=".$action."'>
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS101']."</b></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS106']."</b></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS107']."</b></td>
<td width='40%' align='left' class='tbl2'><b>".$locale['WRS108']."</b></td>
</tr>\n";
   $t=0;
   $result = dbquery("SELECT * FROM ".$db_prefix."forumrang_bilder ORDER BY id ASC");
   while ($data = dbarray($result)) {
      if($t==2){$t=0;}
      $tbl = ($t == 1 ? "tbl2" : "tbl1");
      echo"
<tr>
<td class='$tbl width='40%' align='left'>".$data['id']."</td>
<td class='$tbl width='40%' align='left'><select name='bild".$data['id']."' class='textbox'>
";

      $galarie_pfad = "images";
      $oeffne_galarie_pfad=opendir($galarie_pfad );
      while ($galarie = readdir($oeffne_galarie_pfad))
      {
         if($galarie != "." && $galarie != ".." && substr($galarie,-4) != ".php" &&  $galarie != "Thumbs.db") {
            echo"<option value='".$galarie."'".($data['bild'] == "".$galarie."" ? " selected" : "").">".$galarie."</option>";
         }
      }

      echo"
</select></td>
<td class='$tbl width='40%' align='left'><select name='bildanz".$data['id']."' class='textbox'>
";
      for($r=1;$r <= 5; $r++){
         echo"<option value='".$r."'".($data['anz'] == "".$r."" ? " selected" : "").">".$r."</option>";
      }
      echo"
</select></td>";
      $result2 = dbquery("SELECT * FROM ".$db_prefix."forumrang_bilder WHERE id='".$data['id']."' ORDER BY id ASC");
      $data2 = dbarray($result2);

      echo"<td class='$tbl width='40%' align='left'>";
      for($q=1;$q <= $data2['anz'];$q++){
         echo'<img border="0" src="images/'.$data2['bild'].'">';
      }
      echo"</td>";
      echo"
</tr>
";
      $t++;
   }
   echo"
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td align='center' colspan='2'>
<br>
<input type='submit' name='save_rang_bilder' value='".$locale['WRS105']."' class='button'></td>
</tr>
</table>
</form>\n";
   break;
   ///////////////////////////////////////////   
case 'rextra':
   

   if(isset($_POST['save_rang_extra']) AND  $_POST['save_rang_extra'] != ''){
      $rowsforumrang_extra = dbcount("(id)", "forumrang_extra","typ=".$_POST['groupextra']."");
      if($rowsforumrang_extra == 0 ){
         $result = dbquery("INSERT INTO ".$db_prefix."forumrang_extra (id, typ, name, bild, anz) VALUES('','".$_POST['groupextra']."', '".$_POST['nameextra']."','".$_POST['bildextra']."','".$_POST['anzextra']."')");
      }
      header("Location: rank_system.php?action=".$action."");
   }

   if(isset($_GET['del']) AND !empty($_GET['del']) AND isNum($_GET['del'])){
      $result = dbquery("DELETE FROM ".$db_prefix."forumrang_extra WHERE id='".$_GET['del']."'");
      header("Location: rank_system.php?action=".$action."");
   }

   echo "<form  method='post' action='".$PHP_SELF."?action=".$action."'>
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='25%' align='left' class='tbl2'><b>".$locale['WRS111']."</b></td>
<td width='25%' align='center' class='tbl2'><b>".$locale['WRS104']."</b></td>
<td width='25%' align='center' class='tbl2'><b>".$locale['WRS106']."</b></td>
<td width='25%' align='right' class='tbl2'><b>".$locale['WRS107']."</b></td>
</tr>\n";

   $user_groups = getgroups();
   $user_types = "" ;
   while(list($key, $user_group) = each($user_groups)){
      if ($user_group['0'] != "0") {
         $user_types .= "<option value='".$user_group['0']."'>".$user_group['1']."</option>\n";
      }
   }
   echo"<tr>";
   echo "<td align='left'><select name='groupextra' class='textbox'>\n".$user_types."</select>\n</td>
<td class='$tbl width='25%' align='center'><input type='text' name='nameextra' class='textbox' style='width:150px;'></td>";
   echo"<td align='center'><select name='bildextra' class='textbox'>";
   $galarie_pfad = "images";
   $oeffne_galarie_pfad=opendir($galarie_pfad );
   while ($galarie = readdir($oeffne_galarie_pfad))
   {
      if($galarie != "." && $galarie != ".." && substr($galarie,-4) != ".php" &&  $galarie != "Thumbs.db") {
         echo"<option value='".$galarie."'".($data['bild'] == "".$galarie."" ? " selected" : "").">".$galarie."</option>";
      }
   }
   echo"</select></td>
<td class='$tbl width='25%' align='right'><select name='anzextra' class='textbox'>
";
   for($r=1;$r <= 5; $r++){
      echo"<option value='".$r."' >".$r."</option>";
   }
   echo"
</select></td>";

   echo"</tr>";
   echo"
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td align='center' colspan='2'>
<br>
<input type='submit' name='save_rang_extra' value='".$locale['WRS105']."' class='button'></td>
</tr>
</table>
</form>\n";   

   $result = dbquery("SELECT * FROM ".$db_prefix."forumrang_extra  ORDER BY typ ASC");
   $rows = dbrows($result);
   if ($rows != 0) {
      echo"
<table align='center' width='50%' cellspacing='0' cellpadding='0'>
<tr>
<td width='50%' align='left'><br><br><hr></td>
</tr>\n";

      echo "
<table align='center' width='50%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='25%' align='left' class='tbl2'><b>".$locale['WRS111']."</b></td>
<td width='25%' align='center' class='tbl2'><b>".$locale['WRS106']."</b></td>
<td width='25%' align='center' class='tbl2'><b>".$locale['WRS104']."</b></td>
<td width='25%' align='right' class='tbl2'><b>".$locale['WRS112']."</b></td>
</tr>\n";
      $f = 0;
      while ($data = dbarray($result)) {
         if($f==2){$f=0;}
         $tbl = ($f == 1 ? "tbl2" : "tbl1");
         echo"<tr>
<td width='25%' align='left' class='$tbl'>".getgroupname($data['typ'])."</td>
<td width='25%' align='center' class='$tbl'>";
         for($q=1;$q <= $data['anz'];$q++){
            echo'<img border="0" src="images/'.$data['bild'].'">';
         }
         echo"</td>";
         echo"<td width='25%' align='center' class='$tbl'>".$data['name']."</td>   ";
         echo"<td width='25%' align='right' class='$tbl'><a href='rank_system.php?del=".$data['id']."&action=".$action."'><b>".$locale['WRS113']."</b></a></td>   ";   
         echo"</tr>";
         $f++;
      }
      echo"</table>";
   }
   break;
   ///////////////////////////////////////////   
case 'rtest':
   echo"<center>";
   echo getRank($userdata['user_id'])."<br>";
   echo"</center>";
   break;
   ///////////////////////////////////////////
case 'rupload':

   $upload_folder = "images/";
   $upload_maxsize = 97284;
   $upload_extensions = array(
   ".jpg",
   ".gif",
   ".png"
   );

   if (isset($_GET['del'])) {
      unlink($upload_folder."".$_GET['del']."");
      header("Location: rank_system.php?action=".$action."");
   } else if (isset($_POST['upload_file'])) {
      $upload = $_FILES['upload'];
      if ($upload['name'] != "" && !empty($upload['name']) && is_uploaded_file($upload['tmp_name']) && $upload['size'] <= $upload_maxsize) {
         $upload_ext = strrchr($upload['name'],".");
         if (in_array($upload_ext, $upload_extensions)) {
            $upload_name = $upload['name'];
            move_uploaded_file($upload['tmp_name'], $upload_folder.$upload_name);
            chmod($upload_folder.$upload_name,0644);
         } else {
            $upload_error = $locale['WRS119'];
         }
      } else {
         $upload_error = $locale['WRS120'];
      }

      echo "<center><br>
".(!isset($upload_error) ? header("Location: rank_system.php?action=".$action."") : $upload_error)."<br><br>
<a href='".$PHP_SELF."?action=".$action."'>".$locale['WRS121']."</a><br><br>
</center>\n";
   } else {

      echo "<form name='uploadform' method='post' action='".$PHP_SELF."?action=".$action."' enctype='multipart/form-data'>
<table align='center' width='350' cellspacing='0' cellpadding='0'>
<tr>
<td width='80' class='tbl'>".$locale['WRS122']."</td>
<td class='tbl'><input type='file' name='upload' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='upload_file' value='Upload Datei' class='button' style='width:100px;'><br><br>
Maximale Dateigröße:".parseByteSize($upload_maxsize)."</td>
</tr>
</table>
</form>\n";

      echo "<table width='500' align='center' cellpadding='0' cellspacing='1' class='tbl-border'>
<tr>
<td class='tbl2'><b>".$locale['WRS123']."</b></td>
<td class='tbl2'><b>".$locale['WRS124']."</b></td>
<td class='tbl2'><b>".$locale['WRS125']."</b></td>
<td align='right' class='tbl2'><b>".$locale['WRS126']."</b></td>
</tr>\n";
      $file_list = makefilelist($upload_folder, ".|..|index.php", true);
      if (!isset($file_list)) { $file_count = 0; } else { $file_count = count($file_list); }
      for ($i=0;$i < $file_count;$i++) {
         $file_size = filesize($upload_folder.$file_list[$i]);
         if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl2"; }
         echo "<tr>
<td class='$row_color'>$file_list[$i]</td>
<td class='$row_color'><img border='0' src='images/".$file_list[$i]."'></td>
<td class='$row_color'>".($file_size > 0 ? parseByteSize($file_size) : "-----")."</td>
<td align='right' class='$row_color'><a href='".$PHP_SELF."?del=$file_list[$i]&action=".$action."'>".$locale['WRS113']."</a></td>
</tr>\n";
      }
      echo "</table>\n";
   }
   echo "</td>\n";

   break;   
   
   ///////////////////////////////////////////
case 'def':
   echo $locale['WRS117'];
   break;   
   
}
echo '<br></td>
   </tr>
   </table>
<br>';
closetable();




require_once BASEDIR."footer.php";

?>