Downloads.php With Category Got Error

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

    Downloads.php With Category Got Error

    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.
    Last edited by l0rdrayven; 27.07.09, 09:35.

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

    Comment


      #3
      if only u cud post it up within the code bbcode.

      Comment


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

        Comment


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

          Comment


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

            Comment


              #7
              PHP Code:
              <?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&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['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&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=\"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&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\">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&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>";
              ?>
              </wml>
              Last edited by metulj; 27.07.09, 18:47. Reason: use [ php ] tag [ / php] for posting code

              Comment


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

                PHP Code:
                --
                -- 
                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`
                -- 
                Last edited by metulj; 27.07.09, 18:47. Reason: use [ php ] tag [ / php] for posting code

                Comment


                  #9
                  cudnt pin point d **** up. Does it insert into db? What side of d script shows d error? Post only dat part.

                  Comment


                    #10
                    Hmmm

                    Comment


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

                      Comment


                        #12
                        Read basic php and mysqldata base it will works..

                        Comment


                          #13
                          Anyone can help please...

                          Comment


                            #14
                            PHP Code:
                            -- --------------------------------------------------------

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

                            CREATE TABLE `category` (
                              `
                            idint(50NOT NULL default '0',
                              `
                            namevarchar(30NOT 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` (
                              `
                            idint(10NOT NULL default '0',
                              `
                            urlvarchar(200NOT NULL default '',
                              `
                            categoryint(100NOT NULL default '0',
                              `
                            timeint(100NOT NULL default '0',
                              `
                            uidint(100NOT 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...
                            _______
                            Info & Tips
                            php.net
                            w3schools.com

                            Comment


                              #15
                              PHP Code:
                              INSERT INTO `categoryVALUES (1'Mp3 Files');
                              INSERT INTO `categoryVALUES (2'Ringtones');
                              INSERT INTO `categoryVALUES (3'Video Files');
                              INSERT INTO `categoryVALUES (4'Wallpapers');
                              INSERT INTO `categoryVALUES (5'S40 Themes');
                              INSERT INTO `categoryVALUES (6'S60 Themes');
                              INSERT INTO `categoryVALUES (7'Java Games');
                              INSERT INTO `categoryVALUES (8'Ngage Games');
                              INSERT INTO `categoryVALUES (9'Symbian Games');
                              INSERT INTO `categoryVALUES (10'Gameboy Games');
                              INSERT INTO `categoryVALUES (11'S40 Application');
                              INSERT INTO `categoryVALUES (12'S60 Applications');
                              INSERT INTO `categoryVALUES (13'Rated Xxx Files');
                              INSERT INTO `categoryVALUES (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...
                              _______
                              Info & Tips
                              php.net
                              w3schools.com

                              Comment

                              Working...
                              X