Downloads Category

Started on the old forum in July 2008 · view the original in the archive · old links redirect here

13 replies · 2,037 views · started 18 years ago · 2 min read

4 participants
thanatos Senior · 261 posts #1

thought this might be useful...

make downloads.php and put this..

if($action=="add")
{
addonline(getuid_sid($sid),"Adding Items on Downloads","");
echo "<card id=\"natasu\" title=\"Add Item\">";
echo "<p align=\"center\">";
echo "[b]Item Url:[/b]
";
echo "<input name=\"file\" value=\"http://\" maxlength=\"255\"/>
";
echo "[b]Category:[/b]
";
$vid = mysql_fetch_array(mysql_query("SELECT id FROM category ORDER BY id"));

$vids = mysql_query("SELECT id, name FROM category");
            echo "<select name=\"vid\">";
    while ($vid = mysql_fetch_array($vids))
    {
    echo "<option value=\"$vid[0]\">".htmlspecialchars($vid[1])."</option>";
    }
    echo "</select>
";
echo "
<anchor>Add";
echo "<go href=\"downloads.php?action=additem&sid=$sid\" method=\"post\">";
echo "<postfield name=\"file\" value=\"$(file)\"/>";
echo "<postfield name=\"vid\" value=\"$(vid)\"/>";
echo "</go></anchor>
-----
";
echo "<a href=\"downloads.php?action=main&sid=$sid\">Back to Downloads</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>
";
echo "</p>";
echo "</card>";
}else if($action=="additem")
{
$file      = $_POST['file'];
$vid      = $_POST['vid'];
$uid = getuid_sid($sid);
addonline(getuid_sid($sid),"Adding Item","");
echo "<card id=\"main\" title=\"Natasu\">";
echo "<p align=\"center\">";
$res = mysql_query("INSERT INTO downloads SET uid='".$uid."', url='".$file."', time=".time().", category='".$vid."'");
             if ($res) 
            {
            echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Item Added Successfully!

";
            }else{
            echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!

";
            }
echo "<a href=\"downloads.php?action=main&sid=$sid\">Back to Downloads</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>
";
echo "</p>";
echo "</card>";
}else if($action=="delete")
{
    $did = $_GET["did"];
  addonline(getuid_sid($sid),"Deleting Item","");
  echo "<card id=\"main\" title=\"Natasu\">";
  echo "<p align=\"center\">";
  $itemowner = mysql_fetch_array(mysql_query("SELECT uid FROM downloads WHERE id='".$did."'"));
  if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0])
  {
    $res = mysql_query("DELETE FROM downloads WHERE id='".$did."'");
  if($res)
        {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Successfully Deleted!
";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!
";
        }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this item";
  }

  echo "

";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p></card>";
}else if($action=="downloads")
{

      addonline(getuid_sid($sid),"Downloads Category","downloads.php?action=$action");
        echo "<card id=\"main\" title=\"Downloads\">";
          echo "

";
          $category = mysql_query("SELECT id, name FROM category ORDER BY id");
          while($vcat=mysql_fetch_array($category))
          {
            $link = "<a href=\"downloads.php?action=view&sid=$sid&vid=$vcat[0]\">$vcat[1]</a>";
            echo "
$link";
          }
         echo "</p>";
          echo "<p align=\"center\">";
          echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>";
          echo "</p>";
                echo "</card>";
}else if($action=="view")
{
$vid = $_GET["vid"];

      addonline(getuid_sid($sid),"Downloads","downloads.php?action=$action");
        echo "<card id=\"main\" title=\"Viewing Downloads\">";
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM downloads WHERE category='".$vid."'"));
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;

$sql = "SELECT DISTINCT id, name, uid, url FROM downloads WHERE category='".$vid."' ORDER BY time DESC LIMIT $limit_start, $items_per_page";
echo "

";
    $items = mysql_query($sql);
    echo mysql_error();
    
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        $ext = extension($item[1]);
        $ime = extensionimg($ext);
        $lnk = "<a href=\".$item[3]."\">$ime".htmlspecialchars($item[1])."</a>";
 if(candelete($uid, $item[0]))
      {
        $delnk = "<a href=\"downloads.php?action=delete&sid=$sid&did=$item[0]\">[delete]</a>";
      }else{
        $delnk = "";
      }
      if($who!="")
      {
        $byusr="";
      }else{
        $unick = getnick_uid($item[2]);
        $ulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$item[2]\">$unick</a>";
        $byusr = "- By $ulnk";
      }
      echo "$lnk $byusr $delnk
";
      

    }
    }
echo "</p>";
echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"downloads.php?action=$action&page=$ppage&vid=$vid&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"downloads.php?action=$action&page=$npage&vid=$vid&sid=$sid\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"downloads.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"vid\" value=\"vid\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }
    echo "</p>";
  ////// UNTILL HERE >>
    echo "<p align=\"center\">";
    echo "<a href=\"downloads.php?action=downloads&sid=$sid\">Back to Downloads</a>
";
    echo "<a href=\"index.php?action=main&sid=$sid\">";
    echo "Main Menu</a>";
    echo "</p>";
    echo "</card>";

}
thanatos Senior · 261 posts #2

add this in core.php

///////////////////////////////////////get file ext.

function extension($strfnm)
{
  $str = trim($strfnm);
  if (strlen($str)<4){
    return $str;
  }
  for($i=strlen($str);$i>0;$i--)
  {
    $ext .= substr($str,$i,1);
    if(strlen($ext)==3)
    {
      $ext = strrev($ext);
      return $ext;
    }
  }
}

///////////////////////////////////////get extension icon

function extensionimg($ext)
{
    $ext = strtolower($ext);
    switch ($ext)
    {
      case "jpg":
      case "gif":
      case "png":
      case "bmp":
        return "<img src=\"images/image.gif\" alt=\"image\"/>";
        break;
      case "zip":
      case "rar":
        return "<img src=\"images/pack.gif\" alt=\"package\"/>";
        break;
      case "amr":
      case "wav":
      case "mp3":
        return "<img src=\"images/music.gif\" alt=\"music\"/>";
        break;
      case "mpg":
      case "3gp":
        return "<img src=\"images/video.gif\" alt=\"video\"/>";
        break;
      default:
        return "<img src=\"images/other.gif\" alt=\"!\"/>";
        break;
    }
}

function candelete($uid, $item)
{
  $candoit = mysql_fetch_array(mysql_query("SELECT uid FROM downloads WHERE id='".$item."'"));
  if($uid==$candoit[0]||ismod($uid))
  {
    return true;
  }
  return false;
}
thanatos Senior · 261 posts #3

SQL

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE IF NOT EXISTS `category` (
  `id` int(50) NOT NULL auto_increment,
  `name` varchar(30) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

--
-- Dumping data for table `category`
--

-- --------------------------------------------------------

--
-- Table structure for table `downloads`
--

CREATE TABLE IF NOT EXISTS `downloads` (
  `id` int(10) NOT NULL auto_increment,
  `url` varchar(200) NOT NULL default '',
  `category` int(100) NOT NULL default '0',
  `time` int(100) NOT NULL default '0',
  `uid` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

--
-- Dumping data for table `downloads`
--
subzero Super moderator Fellow · 3,954 posts #5

upload.php

echo "
<form name=\"ufile\" id=\"ufile\" method=\"post\" action=\"upload2.php" enctype=\"multipart/form-data\">
<input name=\"ufile\" type=\"file\" id=\"ufile\" size=\"50\" />

<input type=\"submit\" name=\"Submit\"  value=\"UPLOAD!\"/>
</form>
";

upload2.php

<?php
$ufile = $_post["ufile"];

// Your file name you are uploading
$file_name = $HTTP_POST_FILES['ufile']['name'];

// Define file size limit
$limit_size=104857600;

$file_size=$HTTP_POST_FILES['ufile']['size'];

if($file_size >= $limit_size){
echo "

<p align=\"center\"><font color=\"red\">";
echo "Your file size is over limit
";
echo "
File size limit = 100 MB";
echo "</font></p>";
exit();
}
if($file_name==NULL)
{
echo "

<p align=\"center\"><font color=\"red\">There no File uploaded Go back and upload file</font></p>";
exit();
}
if (!eregi("\.(zip|rar|pdf|doc|xls|php|ppt|txt|exe|gif|png|jpg|jpeg|mp3|wav|mpeg|mpg|mpe|mo
|avi|mid|gif|bmp|mid|midi|3gp|mp3|wav|jar|jad|jpeg|jpg|sis|mmf|amr|png|wbmp|rar|
ip|doc|txt|wma)$",$file_name))
{
print "[b]Unsupported File Extention![/b]";
}else{
$new_file_name=$file_name;
$path= "upload/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "<font color=\"blue\">Successful Uploaded!</font>
";

echo "File Name : ".$new_file_name."
";
echo "File Size : ".$HTTP_POST_FILES['ufile']['size']."
";
echo "File Type : ".$HTTP_POST_FILES['ufile']['type']."
";

}
else
{
echo "Error";
}
}
}
}
?>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

thanatos Senior · 261 posts #6

External image (may be gone)

MANY STILL MISSING IN WAKE OF TYPHOON FRANK

MANILA (23 June 2008) – More than 1,000 remain missing in the Philippines following the battery of typhoon “Frank” this past weekend. Approximately 800 of the missing were passengers aboard the Princess of the Stars ferry, which capsized amid the storm just off Sibuyan Island, north of the province of Romblon. Sulpicio Lines, the operator of the ferry, listed 864 total passengers, but as of press time, only 57 survivors had been rescued with 20 fatalities confirmed.

(List of passengers available on www.sulpiciolines.com)

Aside from the ferry casualties, the government’s National Disaster Coordinating Council reported that there were more than 140 fatalities in land and flood mishaps across the areas slammed by the typhoon. The NDCC also reported over 100 injuries and another 200 missing.

Frank entered the Philippines last June 20 with winds of up to 87 mph (140 kph) and caused flooding and power outages throughout key localities in its path, including Metro Manila. The vast typhoon covered large areas in the Visayas region and affected parts of Mindanao as well.

Sagip Kapamilya, the ABS CBN Foundation’s emergency relief operation program, immediately extended assistance to families affected by typhoon Frank in the areas of Iloilo, Bacolod, General Santos, Roxas, Cotabato and Zamboanga. This is in partnership with ABS-CBN Regional Network Group, the Philippine National Red Cross, the Jollibee Foundation, the Lopez Group Foundation and Lopez Families.

To help in this effort, you may donate through: • PAYPAL Please click here

  • On the “Details” page, please send donation to: foundation@abs-cbni.com
  • In the “For” section, please select “Service / Other”
  • In the “Review Your Payment” page, please leave a message for the recipient and indicate that you are making a donation for “Typhoon Frank Relief”

• CHECK or MONEY ORDER

  • Please make the check payable to the ABS CBN Foundation
  • In the memo portion, please write, “Typhoon Frank Relief”
  • Mail to: ABS CBN Foundation USA 150 Shoreline Drive Redwood City CA 94065

• CASH

  • If donating by cash, please include a note inside the envelope indicating that you would like to donate to “Typhoon Frank Relief”
  • Mail to: ABS CBN Foundation USA 150 Shoreline Drive Redwood City CA 94065
  • The ABS CBN Foundation USA does not encourage donations in kind at this point

For site visitors located in the Philippines, you may also check our Philippine website, www.abs-cbnfoundation.com for further updates. For more inquiries, you may also call our toll free number: (800) 527-2820

Please Donate!

Guest #7

where is downloads.php

inet Senior · 264 posts #8

thanatos rocks! thanks for this..

hehehehe just a former downloads.php something similar with?????

😮

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

Guest #9

similar with?

thanatos Senior · 261 posts #10

where is downloads.php

my first post is the downloads.php..

inet Senior · 264 posts #11

hey thananatos.. may i ask something favor to you?

can you help me?????

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

thanatos Senior · 261 posts #12

hey thananatos.. may i ask something favor to you?

can you help me?????

what is it??

inet Senior · 264 posts #13

what is it??

check your pm inbox...

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

deslex Newbie · 3 posts #14

hey bro..can you put this in a text file then upload here?im getting an error because of just copying the code.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close