News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Download System >> php

Started by rtyug, December 21, 2007, 10:03:38 PM

Previous topic - Next topic

rtyug

http://custom.simplemachines.org/mods/index.php?mod=992

very good system for files


It is needed to do determination of ip and if this ip not included in the list of present networks that to forbid to begin to the swing and get files!!!
more detailed http://ua-ix.com/eng.phtml

I insert a code somewhere, but for me does not turn out to do!!

here code
<?
// wget http://www.colocall.net/ua/?list -O ua-list.txt

function parse_net($ip)
{
sscanf ($ip, "%d.%d.%d.%d/%d", $one, $two, $three, $four, $mask);
$addr = $one*pow(2,24) + $two*pow(2,16) + $three*pow(2,8) + $four;
for ($i = 0; $i < round($mask); $i++) $bitmask += 1 << (31 - $i);
return array($addr, $addr+abs($bitmask));
}

function parse_ip($ip)
{
sscanf ($ip, "%d.%d.%d.%d", $one, $two, $three, $four);
return $one*pow(2,24) + $two*pow(2,16) + $three*pow(2,8) + $four;
}
function check_ip($ip)
{
$f=file('ua-list.txt');
$IP=parse_ip($ip);
foreach ($f as $net)
{
list($min,$max)=parse_net(trim($net));
if ($IP>=$min && $IP<$max) return true;
}
return false;
}

$ip=$_SERVER["argv"][1];

if (check_ip($ip)) echo "OK - host '$ip' in UA-IX\n";
else echo "FALSE - host '$ip' NOT in UA-IX\n";

?>


вот код download.php

http://2info.dp.ua/403/download.txt

rtyug

???????????
$ip = getenv('REMOTE_ADDR');

??????????

// Check if downloads are auto approved
    $approved = (allowedTo('downloads_autoapprove') ? 1 : 0);

    // Allow comments on file if no setting set.
    if (empty($modSettings['down_commentchoice']))
        $allowcomments = 1;


    if ($title == '')
        fatal_error($txt['downloads_error_no_title'],false);
    if ($cat == '')
        fatal_error($txt['downloads_error_no_cat'],false);

    if ($modSettings['down_set_enable_multifolder'])
        CreateDownloadFolder();

rtyug

if I got it right, a script is written very difficultly and done in order that did not break up a forum!!

he very needs me!
I thought that able to close access a method .htaccess, but did not turn out

it can be YOU something is not clear? and did I clear write as though...?

I wait an answer or will put to death itself at a wall
THANK YOU


Advertisement: