Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    5
    Member #
    14194
    I am trying to make a download section for my forum connecting to a differnt site
    here is what ive got so far

    PHP Code:
    function template_main()
    {
        global 
    $context$scripturl$txt$user_info;
        
    theme_linktree();

        
    $rurl 'http://www.mysite.com/Downloads/';
        
    $surl 'Sources/Downloadimg.php?';

    function 
    e($s){$p=strrpos($s,'.');return substr($s,$p+1,strlen($s));}
    function 
    ($a,$c,$o='asc',$t=SORT_STRING){if(!isset($a[0][$c]))return $a;for ($i=0;$i<count($a);$i++)$temp[$i]=&$a[$i][$c];$o=($o=='asc')?SORT_ASC:SORT_DESC;array_multisort($temp,$o,$t,$a);return $a;}

        
    $sb=isset($_GET['s'])?$_GET['s']:0;
        
    $so=isset($_GET['o'])?$_GET['o']:'asc';
        
    $st=$sb==='s'||$sb==='m'?SORT_NUMERIC:SORT_STRING;
        
    $d=isset($_GET['d'])?urldecode($_GET['d']):'';
        
    $d=$d!==''&&$d!=='/'?trim($d,'/').'/':'';
        
    $p=$rurl.$d;
        
    $h=@fopen($p"r");
        if(
    strstr($d,'../'))exit('Denied');
        if(!
    $h)exit('<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><td width="100%" class="titlebg">'.$txt['downloads_6'].'</td></tr></table></div>');
        
    $F=array();$D=array();
          while(
    FALSE!==($f=fread($h"4096")))if($f[0]!=='.')if(is_dir($p.$f))$D[]=array('n'=>$f,'m'=>
    filemtime($p.$f),'s'=>filesize($p.$f),'t'=>'Directory');else$F[]=array('n'=>$f,'m'=>
    filemtime($p.$f),'t'=>e($f),'s'=>filesize($p.$f));
            echo 
    $h;
        if(
    $sb){$F=s($F,$sb,$so,$st);$D=s($D,$sb,$so,$st);}
        print 
    '<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="4"><tr><td colspan="5" class="titlebg">';
        print 
    $txt['downloads_8'];
        if(
    $d!==''){$t=explode('/',trim($d,'/'));for($i=0,$r=array(),$z='';($r[]=@$t[$i]),$z=@$t[$i];$i++) { print(implode('/',$r)!==trim($d,'/'))? ('<a href="'.$scripturl.'?action=downloads&amp;d='.implode('%2F',$r).'">'.$z.'</a> / ' ):$z;}}
        
    $f=trim($d,'/');
      print 
    '</td></tr><tr><td class="catbg">&nbsp;</td>'
        
    .'<td class="catbg"><a href="'.$scripturl.'?action=downloads&amp;s=n&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">'.$txt['downloads_2'].'</a></td>'
        
    .'<td class="catbg"><a href="'.$scripturl.'?action=downloads&amp;s=s&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">'.$txt['downloads_3'].'</a></td>'
        
    .'<td class="catbg"><a href="'.$scripturl.'?action=downloads&amp;s=t&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">'.$txt['downloads_4'].'</a></td>'
        
    .'<td class="catbg" nowrap="nowrap"><a href="'.$scripturl.'?action=downloads&amp;s=m&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">'.$txt['downloads_5'].'</a></td></tr>';
        for(
    $i=0,$c='';($c=@$D[$i++]);){print '<tr><td class="windowbg"><center><img src="'.$surl.'i=dir" alt="'.$c['n'].'"/></center></td><td class="windowbg2"><a href="'.$scripturl.'?action=downloads&amp;d='.urlencode($d.$c['n']).'">'.$c['n'].'</a></td><td class="windowbg">&nbsp;</td><td class="windowbg2">&nbsp;</td><td class="windowbg">'.date('m/d/Y h:i A',$c['m']).'</td></tr>';}
        for(
    $i=0,$c='';($c=@$F[$i++]);){print '<tr><td class="windowbg"><center><img src="'.$surl.'i='.$c['t'].'" alt="'.$c['n'].'"/></center></td><td class="windowbg2"><a href="download.php?d='.$_GET['d'].'&amp;name='.$c['n'].'">'.$c['n'].'</a></td><td class="windowbg">'.number_format($c['s']/1024,1).'KB</td><td class="windowbg2">'.$c['t'].'</td><td class="windowbg">'.date('m/d/Y h:i A',$c['m']).'</td></tr>';}
        print 
    '<tr><td colspan="5" class="windowbg"><center>www.mysite.co.uk '.$txt['downloads_7'].' </center></td></tr></table></div>';

    however I keep getting this error

    PHP Code:

    filemtime
    () [<a href='function.filemtime'>function.filemtime</a>]: Stat failed for http://www.mysite.com/Downloads/ 
    thxs for any help

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    139 times
    yo sharpy, ya damn HoH

    the "other site", do they allow other sites to hotlink to their site?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    5
    Member #
    14194
    yep hehe its my own other site :knockedout:

    there on two different host because the one with the downloads is the storage one the bandwidth is cheaper


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:41 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com