Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev > Mods & Themes
Reply
  #1  
Old 29th June 2008, 12:55
johnake's Avatar
johnake johnake is offline
Senior Member
 
Join Date: Dec 2007
Posts: 52
Default [Netvision 2.0] Category Manager
I noticed that in the netvision 2.0 source, there is no category manager. So I picked up my category management file from tbdev and adapted for this source. So let's begin.

1.Create a new file called editcats.php
2.Paste this code into this file:

PHP Code:
<?php

/*Tracker categories management
Original source from: TBDEV.NET
Adapted for NV Tracker 2.0 */

ob_start();
require_once(
"include/bittorrent.php");
dbconn(false);
loggedinorreturn();
if (
get_user_class() < UC_ADMINISTRATOR) {
die(
"Access denied.");
}
mysql_connect($mysql_host,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
stdhead("Categories");
begin_frame("<font size=2 align=center>Manage Tracker Categories</font><tr></tr>"false"100%"); 
print(
"</br>");
print(
"<table align=center width=70% border=0 cellspacing=0 cellpadding=2><tr><td align=center>\n");

///////////////////// D E L E T E C A T E G O R Y \\\\\\\\\\\\\\\\\\\\\\\\\\\\

$sure $_GET['sure'];
if(
$sure == "yes") {
$delid $_GET['delid'];
$query "DELETE FROM categories WHERE id=" .sqlesc($delid) . " LIMIT 1";
$sql mysql_query($query);
echo(
"Category succesfully deleted! [ Back ]");
end_frame();
stdfoot();
die();
}
$delid $_GET['delid'];
$name $_GET['cat'];
if(
$delid 0) {
echo(
"Are you sure you would like to delete this category? ($name) ( Y / N )");
end_frame();
stdfoot();
die();

}

///////////////////// E D I T A C A T E G O R Y \\\\\\\\\\\\\\\\\\\\\\\\\\\\

$edited $_GET['edited'];
if(
$edited == 1) {
$id $_GET['id'];
$cat_name $_GET['cat_name'];
$cat_img $_GET['cat_img'];
$query "UPDATE categories SET
name = '
$cat_name',
image = '
$cat_img' WHERE id=".sqlesc($id);
$sql mysql_query($query);
if(
$sql) {
echo(
"<table class=main align=center cellspacing=0 cellpadding=5 width=50%>");
echo(
"<tr><td><div align='center'>Well done! Your category has been edited succesfully! [ Back ]</div></tr>");
echo(
"</table>");
end_frame();
stdfoot();
die();
}
}

$editid $_GET['editid'];
$name $_GET['name'];
$img $_GET['img'];
if(
$editid 0) {
echo(
"<form name='form1' method='get' action='" $_SERVER['PHP_SELF'] . "'>");
echo(
"<table class=main cellspacing=0 align=center cellpadding=5 width=50%>");
echo(
"<div align='center'><input type='hidden' name='edited' value='1'>Now editing category &quot;$name&quot;</div>");
echo(
"
"
);
echo(
"<input type='hidden' name='id' value='$editid'<table class=main cellspacing=0 cellpadding=5 width=50%>");
echo(
"<tr><td>Category Name: </td><td align='right'><input type='text' size=50 name='cat_name' value='$name'></td></tr>");
echo(
"<tr><td>Category Image Name: </td><td align='right'><input type='text' size=50 name='cat_img' value='$img'></td></tr>");
echo(
"<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>");
echo(
"</table></form>");
end_frame();
stdfoot();
die();
}

///////////////////// A D D A N E W C A T E G O R Y \\\\\\\\\\\\\\\\\\\\\\\\\\\\

$add $_GET['add'];
if(
$add == 'true') {
$cat_name $_GET['cat_name'];
$cat_img $_GET['cat_img'];
$query "INSERT INTO categories SET
name = '
$cat_name',
image = '
$cat_img'";
$sql mysql_query($query);
if(
$sql) {
$success TRUE;
} else {
$success FALSE;
}
}
begin_table(TRUE);
print(
"Add A New Category!");
print(
"
"
);
print(
"
"
);
echo(
"<form name='form1' method='get' action='" $_SERVER['PHP_SELF'] . "'>");
echo(
"<tr><td>Category Name: </td><td align='right'><input type='text' size=50 name='cat_name'></td></tr>");
echo(
"<tr><td>Category Image Name: </td><td align='right'><input type='text' size=50 name='cat_img'><input type='hidden' name='add' value='true'></td></tr>");
echo(
"<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>");
echo(
"</table>");
if(
$success == TRUE) {
print(
"Success!");
}
echo(
"
"
);
echo(
"</form>");

///////////////////// E X I S T I N G C A T E G O R I E S \\\\\\\\\\\\\\\\\\\\\\\\\\\\

print("Existing Categories:");
print(
"
"
);
print(
"
"
);
begin_table(TRUE);
echo(
"<td class=tablecat>ID:</td><td class=tablecat>Name:</td><td class=tablecat >Picture:</td><td class=tablecat>Browse Category:</td><td class=tablecat >Edit:</td><td class=tablecat>Delete:</td>");
$query "SELECT * FROM categories WHERE 1=1";
$sql mysql_query($query);
while (
$row mysql_fetch_array($sql)) {
$id $row['id'];
$name $row['name'];
$img $row['image'];
echo(
"<tr><td class=tablea><div align='center'>$id</div> </td> <td class=tableb>$name</td> <td class=tablea><div align='center'>[img]$DEFAULTBASEURL/pic/$img[/img]<div></td><td class=tableb><div align='center'>[img]$DEFAULTBASEURL/pic/viewnfo.gif[/img]</div></td> <td class=tablea><div align='center'>[img]$DEFAULTBASEURL/pic/multipage.gif[/img]</div></td> <td class=tableb><div align='center'>[img]$DEFAULTBASEURL/pic/warned2.gif[/img]</div></td></tr>");
}

end_frame();
end_frame();
stdfoot();

?>
After that, the only thing you need to do is to add this file in the staffpanel.
__________________
PHP Code:
class mySelf extends World
   
{
       public 
$health;
       private 
$friends;
       protected 
$love;
  
   public function 
__construct()
  {
       
$this->health 100;
       
$this->friends 2;
       
$this->love true;
  }
  protected function 
__love()
  { 
      
//has a bug... for the moment...
      //will fix it later.. until then:
      
sleep(15*365*24*3600);
  }

Reply With Quote
The Following User Says Thank You to johnake For This Useful Post:
Tibys08 (29th May 2011)
  #2  
Old 29th June 2008, 13:27
Fynnon's Avatar
Fynnon Fynnon is offline
xxx
 
Join Date: Nov 2007
P2P
Posts: 971
Default Re: [Netvision 2.0]Category Manager
Great Work, Thank You !

Reply With Quote
  #3  
Old 2nd May 2009, 15:05
crztz's Avatar
crztz crztz is offline
Senior Member
 
Join Date: Apr 2009
P2P
Posts: 34
Default
I think this would go better.. but.. you decide...

it takes all the category pics from pic folder and you can associate/crate a a category with the category pic you select


The code:


[php]

<?php

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

if (get_user_class() < UC_ADMINISTRATOR)
stderr("w00t","w00t");

// Kategorie hinzuf
Reply With Quote
Reply

Tags
20 , category , manager , netvision

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Netvision v1.1 sammygo Downloads 6 27th December 2013 13:01
NetVision v2.0 Sky Downloads 26 29th March 2012 10:45
Netvision v1.0 Fynnon Downloads 23 1st November 2009 20:58
File manager Ginno Free Torrent Source 8 29th January 2009 15:35
[Help request] For stylesheets manager Kotafi TBDev 7 13th October 2008 06:55



All times are GMT +2. The time now is 12:40. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2021, vBulletin Solutions Inc.