Downloads.php With Category Got Error

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

19 replies · 1,126 views · started 17 years ago · 1 min read

6 participants
l0rdrayven Developer · 83 posts #1

hello mates,i need your help once again.No filipino coders want to help me,so much better to ask foreign coders.I think they have a big heart to help those n0ob coders.My problem is this one.. Ive created a download.php file with script inside but these codes has errors and i dont know what part is.Please help me to fix this..Heres the file, Downloads.txt Please kindly post back the fix download.txt or download.php file here,thanks a lot mates..Im hoping for your help guys..thanks again.

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #2

also the sql for that download got errors.It say "Theres an error in the syntax near "'id int(50) etc,etc please mates fix also this sql ive created for that download script.I really need this type of download in lavalair,vault and hotlinking type.heres the sql. Download Sql.txt Also post back the fix Download sql.txt file here.Thank you so much for those kindhearted one who will goin to help me.

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #4

But if im goin to post the code my friend i cant copy the exact code your goin to post coz i got lot of errors in copying codes cause i only use a mobile phone.But i will try it..

Not i rip persons off i will also do your arse !

koizumi Developer · 81 posts #5

what host are you using? i dont think wen.ru supports php.

l0rdrayven Developer · 83 posts #6

n0ph im n0t using wenru my friend.I just uploaded that file there..Ayway heres the script.Please fix this out to make it work in my lavalair site.

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #7
<?php
include("config.php");
include("core.php");
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php
$bcon = connectdb();
if (!$bcon)
{
    echo "<card id=\"main\" title=\"PinoyGSM Error!\">";
    echo "<p align=\"center\">";
    echo "<img src=\"../images/exit.gif\" alt=\"!\"/><br/>";
    echo "<b>Error! Cannot Connect To Database...</b><br/><br/>";
    echo "This error happens usually when backing up the database, please be patient...";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);

cleardata();

if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
        echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
}
if(isbanned($uid))
    {
      echo "<card id=\"main\" title=\"$sitename\">";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
      echo "<b>You are Banned</b><br/><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
   $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "<b>Time Left: </b>$rmsg<br/>";
      $nick = getnick_uid($banto[2]);
   echo "<b>By: </b>$nick<br/>";
   echo "<b>Reason: </b>$banto[1]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

////////////////////////////////////////MAIN PAGE

if($action=="add")
{
addonline(getuid_sid($sid),"Adding Items On Downloads","");
echo "<card id=\"main\" title=\"Add Item\">";
echo "<p align=\"center\">";
echo "Download Url:
";
echo "<input name=\"file\" value=\"http://\" maxlength=\"255\"/> ";
echo "Category:
";
$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 Downloads","");
echo "<card id=\"main\" title=\"Add Downloads\">";
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=\"Downloads\">";
  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\">MainMenu</a>";
          echo "</p>";
                echo "</card>";
}
else if($action=="view")
{
$vid = $_GET["vid"];
      addonline(getuid_sid ($sid),"Vieweng Downloads","downloads.php?action=$action");
        echo "<card id=\"main\" title=\"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>";
?>
</wml>

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #8

And heres the sql,It got errors too Bad syntax,or syntax error at line or near "'id' int(50) I also added a category names in line of dumping table for categories but i dont think if i did this right .....,,,


--
-- Table structure for table `category`
--
CREATE TABLE `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` --
  Mp3 Files
  Ringtones
  Video Files
  Wallpapers
  S40 Themes
  S60 Themes
  Java Games
  Ngage Games
  Symbian Games
  Gameboy Games
  S40 Application
  S60 Applications
  Rated Xxx Files
  Scripts/Others
-- --------------------------------------------------------
--
-- Table structure for table `downloads`
--
CREATE TABLE `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`
--

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #11

haayy i think theres no chance for me to have a download feature in my site,

Not i rip persons off i will also do your arse !

kabooms Developer · 80 posts #12

Read basic php and mysqldata base it will works..

l0rdrayven Developer · 83 posts #13

Anyone can help please...

Not i rip persons off i will also do your arse !

subzero Super moderator Fellow · 3,954 posts #14
-- --------------------------------------------------------

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

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

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

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

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

CREATE TABLE `downloads` (
  `id` int(10) NOT NULL default '0',
  `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;

-- 
-- Dumping data for table `downloads`
-- 

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... _______…

subzero Super moderator Fellow · 3,954 posts #15
INSERT INTO `category` VALUES (1, 'Mp3 Files');
INSERT INTO `category` VALUES (2, 'Ringtones');
INSERT INTO `category` VALUES (3, 'Video Files');
INSERT INTO `category` VALUES (4, 'Wallpapers');
INSERT INTO `category` VALUES (5, 'S40 Themes');
INSERT INTO `category` VALUES (6, 'S60 Themes');
INSERT INTO `category` VALUES (7, 'Java Games');
INSERT INTO `category` VALUES (8, 'Ngage Games');
INSERT INTO `category` VALUES (9, 'Symbian Games');
INSERT INTO `category` VALUES (10, 'Gameboy Games');
INSERT INTO `category` VALUES (11, 'S40 Application');
INSERT INTO `category` VALUES (12, 'S60 Applications');
INSERT INTO `category` VALUES (13, 'Rated Xxx Files');
INSERT INTO `category` VALUES (14, ' Scripts/Others');

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... _______…

l0rdrayven Developer · 83 posts #16

thank you sir subzero.

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #17

I cant use this my friend.All i need is the fix script ive posted in the previous page.which is downloads.php file,Thats the only one thing i wish to be work fine.But thanks for the effort of posting that code.

Not i rip persons off i will also do your arse !

robzky Developer · 205 posts #18

Guys, I have a problem in my VAULT..

Dead link is not allowed!

How can i fix this! thanks.

LESS TALK. LESS MISTAKE.

HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

kabooms Developer · 80 posts #20

Freehosting not allowed HTTP upload tnt and u need to set up phpinfo() of it.

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