testing help!! uload via url

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

    testing help!! uload via url

    From wap.net.ph i got a error white screen in genproc.php its a good script can some body test and fix it!!
    index.php
    Code:
    
    //////////////////////////////////////////add vault
    
    else if($action=="addvlt")
    {
    
    
    if(!getplusses(getuid_sid($sid))>25)
        {
            echo "<card id=\"main\" title=\"wap.net.ph\">";
          echo "<p align=\"center\">";
          echo "At least you should have 25 plusses to add an item to your vault<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid&amp;type=send\">Main Menu</a>";
          echo "</p>";
          echo "</card>";
          echo "</wml>";
          exit();
        }
        addonline(getuid_sid($sid),"v2:Adding Vault Item","index.php?action=$action");
    
        echo "<title>Add Vault</title>";
        
    
        echo "<p align=\"left\">Earn more plusses by adding more files :)<br/><a href=\"wap.net.ph/upload.php?sid=$sid&amp;ver=html\">Upload files from your Phone</a><br/>";
        echo "<form action=\"genproc.php?action=addvlt&amp;sid=$sid\" method=\"post\">";
    
        echo "Item Name: <input name=\"viname\" maxlength=\"50\"/><br/>";
        
        echo "Item URL: <input name=\"vilink\" maxlength=\"255\" value=\"http://\"/><br/>";
       echo "Description: <input name=\"videsc\" maxlength=\"50\"/><br/>";
    echo "<select name=\"did\">";
       echo "<option value=\"1\">Symbian Software</option>";
      echo "<option value=\"2\">Java Software</option>";
      echo "<option value=\"3\">Anti Virus</option>";
      echo "<option value=\"4\">s40v2/s40v3-Themes</option>";
      echo "<option value=\"5\">s60/s60v3/Nseries/-Themes </option>";
      echo "<option value=\"6\">Sony Ericsson-Themes </option>";
      echo "<option value=\"7\">s30/40/s40v2-Games </option>";
      echo "<option value=\"8\">s60/s60v3 Games </option>";
      echo "<option value=\"9\">Nseries/Eseries/Ngage-Games </option>";
      echo "<option value=\"10\">Sony Ericsson-Games</option>";
     echo "<option value=\"11\">Full MP3</option>";
      echo "<option value=\"12\">3GP Videos</option>";
      echo "<option value=\"13\">Scandal</option>";
    echo "<option value=\"14\">Gameboy Games</option>";
      echo "<option value=\"15\">Naruto-Themes/Poly/MP3</option>";
      echo "<option value=\"16\">MP3/MIDI/WAV/POLY/AMR/RAR</option>";
         echo "<option value=\"17\">Opera Software</option>";
         
    
      echo "</select><br/>";
        echo "<input type=\"submit\" value=\"Upload\"/>";    
    echo "</form>";
    
             echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid&amp;type=send\">";
    echo "Main menu</a>";
        echo "</p>";
       
    }

    in genproc.php
    Code:
    else if($action=="addvlt")
    {
    
    if(!getplusses(getuid_sid($sid))>25)
        {
          echo "<title>pinoykindat.net</title>";
          echo "<p align=\"center\">";
          echo "Only the user of 25+ plusses can add a vault item<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
      $viname = $_POST["viname"];
      $vilink = $_POST["vilink"];
    $videsc = $_POST["videsc"];
      $did = $_POST["did"];
     //$qut = $_POST["qut"];
    
     $fname= array_reverse(explode("/",$vilink));
      addonline(getuid_sid($sid),"Adding A Vault Item","index.php?action=main");
    
    error_reporting(0);
     if(strlen($viname)<5)
    {
          echo "<title>pinoykindat.net</title>";
          echo "<p align=\"center\">";
            echo "5 minimum letters for the title!";
      echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\">";
      echo "Main menu</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
     if(strlen($vilink)<5)
    {
          echo "<title>pinoykindat.net</title>";
          echo "<p align=\"center\">";
            echo "5 minimum letters for the link!";
      echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\">";
      echo "Main menu</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
     if(strlen($videsc)<5)
    {
          echo "<title>pinoykindat.net</title>";
          echo "<p align=\"center\">";
            echo "5 minimum letters for the description!";
      echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\">";
      echo "Main menu</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
    if(spacesin($vilink))
    {
          echo "<card id=\"main\" title=\"Error adding\">";
          echo "<p align=\"center\">";
          echo "No space input!<br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main menu</a>";
          echo "</p>";
          echo "</body>";
          echo "</html>";
          exit();
        }
    $fname= array_reverse(explode("/",$vilink));
    
    if (!eregi("\.(mid|gif|bmp|mid|midi|3gp|mp3|mp4|wav|mpn|nth|mpc|jar|jad|jpeg|jpg|sis|mmf|amr|thm|png|wbmp|rar|zip)$",$fname[0]))
    {
    echo "<card id=\"main\" title=\"Error adding\">";
          echo "<p align=\"center\">";
    echo "<b>Unsuported File extention!</b><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main menu</a>";
                      echo "</p></card></wml>";
    			exit();
    			}
    echo "<title>pinoykindat.net</title>";
          echo "<p align=\"center\">";
          $crdate = time();
          //$uid = getuid_sid($sid);
    
       $res = false;
    
    $defaultDest = "$dir";
    $slash       = "/";
    
    $dest        = "./pkfiles/";
     $fname= array_reverse(explode("/",$vilink));
    $ds = array($dest, $slash, $fname[0]);
    		$ds = implode("", $ds);
      if (!copy($vilink, $ds))
    {
     echo "Dead link is not allowed!(<br/>"; 
    }else{       
      $fname= array_reverse(explode("/",$vilink));
    $ext = getext($fname[0]);
            $mime = getextfile($ext);
    $fname= array_reverse(explode("/",$vilink));
       $filesize = filesize($ds);
    $filesize = $filesize / 1048576;
    $fsize = 0;
    $fsizetxt = "";
      if ($filesize < 1)
      {
         $fsize = round($filesize*1024,0);
         $fsizetxt = "".$fsize."KB";
        $check1 = "KB";
      }else{
         $fsize = round($filesize,2);
         $fsizetxt = "".$fsize." MB";
    $check1 = "MB";
      }
      $res = mysql_query("INSERT INTO ibwf_vault SET uid='".$uid."', title='".mysql_escape_string($viname)."', pudt='".$crdate."', did='".$did."', info='".$videsc."',filesize='".$fsizetxt."', mime='".$mime."', itemurl='".$fname[0]."'");
     if($res)
          {
    mysql_query("UPDATE ibwf_users SET plusses=plusses-'5' WHERE id='".$uid."'");
     echo "File added successfully!";
          }else{
            
          }
    }
          echo "<br/><br/>";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">";
    echo "Main menu</a>";
          echo "</p>";
          echo "</body>";
    
    }
    in php.ini temp directory "/home/..../pkfiles"
    file upload on
    max upload 2MB
    The file was working in folder only problem in mysql it doest update the file enter my problem is Give me white screen i think in mysql got an error or in genproc test this guys heres my sql table 4 this!
    Code:
    --
    -- Table structure for table `ibwf_vault`
    --
    
    CREATE TABLE IF NOT EXISTS `ibwf_vault` (
      `id` int(100) NOT NULL auto_increment,
      `uid` int(100) NOT NULL default '0',
      `title` varchar(50) NOT NULL default '',
      `pudt` int(100) NOT NULL default '0',
      `did` int(100) NOT NULL default '0',
      `info` varchar(100) NOT NULL default '0',
      `filesize` varchar(60) NOT NULL,
      `mime` int(100) NOT NULL default '0',
      `itemurl` varchar(255) NOT NULL default '',
      `downloads` int(100) NOT NULL default '0',
      PRIMARY KEY  (`id`),
      UNIQUE KEY `uid` (`uid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    
    --
    -- Dumping data for table `ibwf_vault`
    --
    core.php
    Code:
    ///////////////////////////////////////get file ext.
    
    function getext($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 getextimg($ext)
    {
        $ext = strtolower($ext);
        switch ($ext)
        {
          case "jpg":
          case "gif":
          case "png":
          case "bmp":
            return "<img src=\"http://coding-talk.com/images/image.gif\" alt=\"image\"/>";
            break;
          case "zip":
          case "rar":
            return "<img src=\"http://coding-talk.com/images/pack.gif\" alt=\"package\"/>";
            break;
          case "amr":
          case "wav":
          case "mp3":
            return "<img src=\"http://coding-talk.com/images/music.gif\" alt=\"music\"/>";
            break;
          case "mpg":
          case "3gp":
            return "<img src=\"http://coding-talk.com/images/video.gif\" alt=\"video\"/>";
            break;
          default:
            return "<img src=\"http://coding-talk.com/images/other.gif\" alt=\"!\"/>";
            break;
        }
    }
    Last edited by kabooms; 29.07.09, 13:37.

    #2
    close this thread i already fix by my own thankz.
    Last edited by kabooms; 29.07.09, 15:39.

    Comment

    Working...
    X