Downloads Category

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Downloads Category

    thought this might be useful...

    make downloads.php and put this..
    Code:
    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&amp;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&amp;sid=$sid\">Back to Downloads</a>
    ";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a>
    ";
    echo "</p>";
    echo "</card>";
    }else if($action=="additem")
    {
    $file      = $_POST[&#39;file&#39;];
    $vid      = $_POST[&#39;vid&#39;];
    $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=&#39;".$uid."&#39;, url=&#39;".$file."&#39;, time=".time().", category=&#39;".$vid."&#39;");
                 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&amp;sid=$sid\">Back to Downloads</a>
    ";
    echo "<a href=\"index.php?action=main&amp;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=&#39;".$did."&#39;"));
      if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0])
      {
        $res = mysql_query("DELETE FROM downloads WHERE id=&#39;".$did."&#39;");
      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&#39;t delete this item";
      }
    
    
      echo "
    
    ";
      echo "<a href=\"index.php?action=main&amp;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&amp;sid=$sid&amp;vid=$vcat[0]\">$vcat[1]</a>";
                echo "
    $link";
              }
             echo "</p>";
              echo "<p align=\"center\">";
              echo "<a href=\"index.php?action=main&amp;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=&#39;".$vid."&#39;"));
    $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=&#39;".$vid."&#39; 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&amp;sid=$sid&amp;did=$item[0]\">[delete]</a>";
          }else{
            $delnk = "";
          }
          if($who!="")
          {
            $byusr="";
          }else{
            $unick = getnick_uid($item[2]);
            $ulnk = "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;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&amp;page=$ppage&amp;vid=$vid&amp;sid=$sid\">«PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"downloads.php?action=$action&amp;page=$npage&amp;vid=$vid&amp;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&amp;sid=$sid\">Back to Downloads</a>
    ";
        echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
        echo "Main Menu</a>";
        echo "</p>";
        echo "</card>";
    
    }

    #2
    add this in core.php

    Code:
    ///////////////////////////////////////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=&#39;".$item."&#39;"));
      if($uid==$candoit[0]||ismod($uid))
      {
        return true;
      }
      return false;
    }

    Comment


      #3
      SQL
      Code:
      -- --------------------------------------------------------
      
      --
      -- Table structure for table `category`
      --
      
      CREATE TABLE IF NOT EXISTS `category` (
        `id` int(50) NOT NULL auto_increment,
        `name` varchar(30) NOT NULL default &#39;&#39;,
        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 &#39;&#39;,
        `category` int(100) NOT NULL default &#39;0&#39;,
        `time` int(100) NOT NULL default &#39;0&#39;,
        `uid` int(100) NOT NULL default &#39;0&#39;,
        PRIMARY KEY  (`id`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
      
      --
      -- Dumping data for table `downloads`
      --

      Comment


        #4
        its up to you if you will allow file uploads.. you may search the forum for the file uploader..

        Comment


          #5
          upload.php
          Code:
          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
          Code:
          <?php
          $ufile = $_post["ufile"];
          
          // Your file name you are uploading
          $file_name = $HTTP_POST_FILES[&#39;ufile&#39;][&#39;name&#39;];
          
          // Define file size limit
          $limit_size=104857600;
          
          $file_size=$HTTP_POST_FILES[&#39;ufile&#39;][&#39;size&#39;];
          
          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[&#39;ufile&#39;][&#39;tmp_name&#39;], $path))
          {
          echo "<font color=\"blue\">Successful Uploaded!</font>
          ";
          
          echo "File Name : ".$new_file_name."
          ";
          echo "File Size : ".$HTTP_POST_FILES[&#39;ufile&#39;][&#39;size&#39;]."
          ";
          echo "File Type : ".$HTTP_POST_FILES[&#39;ufile&#39;][&#39;type&#39;]."
          ";
          
          }
          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...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment


            #6


            MANY STILL MISSING IN WAKE OF TYPHOON FRANK

            MANILA (23 June 200 – 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

            <span style="font-size:14pt;line-height:100%">Please Donate!</span>

            Comment


              #7
              where is downloads.php

              Comment


                #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.

                Comment


                  #9
                  similar with?

                  Comment


                    #10
                    where is downloads.php[/b]
                    my first post is the downloads.php..

                    Comment


                      #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.

                      Comment


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

                        can you help me?????[/b]

                        what is it??

                        Comment


                          #13
                          what is it??[/b]
                          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.

                          Comment


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

                            Comment

                            Working...
                            X