Помогите пожалуйста разобраться со скриптом [php]

Discussion in 'PHP' started by Haruka, 21 Oct 2007.

  1. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Немогу разобраться как добавить в скрипт клик клуба новых операторов. Помогите пожалуйста! Мне надо срочно до понедельника, от этого зависит моя карьера!!
    Вот скрипт:
    PHP:
    <?
    if (
    eregi("oper.php",$PHP_SELF))
    {
        
    //Header("Location: index.php");
        
    die();
    }
    $opertrim(htmlspecialchars(stripslashes(@$_GET['oper'])));
    $oper = @preg_replace("/[^0-9]/"""$oper);

    if(
    $oper != "")
    {
        if(
    $oper or $oper>25)
        {
            
    $oper 0;
        }

    }else{
        
    $ip = @$_SERVER['REMOTE_ADDR'];
        
    $ips split("\.""$ip");
        @
    $ipnum $ips[3] + $ips[2] * 256 $ips[1] * 256 256 $ips[0] * 256 256 256;
        
    $oper 0;
        
    $IP101 = array(2130706433,1402273792,1402277888,1402279936,1402281984,1402284032,1402286080,1402287104,3251233792,3582031776);
        
    $IP201 = array(2130706687,1402275839,1402278911,1402280959,1402283007,1402285055,1402287103,1402288127,3251234815,3582031807);
        
    $IP102 = array(1433657344,3648405504,3648406528,3648408576,3648409600,3648410624,3648411648,3648412672);
        
    $IP202 = array(1433657599,3648406527,3648407551,3648409599,3648410623,3648411647,3648412671,3648413695);
        
    $IP103 = array(1047070464,1401450496,1401451520,1406861312,1425989632,1441366016,3272364544,3564675072,3564676832,3571187712,3641816064,3641816576);
        
    $IP203 = array(1047072255,1401450751,1401451775,1406869503,1425994239,1441371903,3272364799,3564683263,3564676863,3571253247,3641816319,3641816831);
        
    $IP104 = array(1347599104,3588519936);
        
    $IP204 = array(1347599359,3588520447);
        
    $IP105 = array(1042394624,1346950400,1347674112,1360933376,1372794624,1410457600,3258356736,3277188608,3281465344,3287259392,3559689216,3562834880,3578831872,3579259392,3579267072,3579269120,3641237504,3641237504,3645018112,3645566976,3648478720);
        
    $IP205 = array(1042394879,1346950655,1347678207,1360933887,1372794879,1410459647,3258357759,3277188863,3281465599,3287259647,3559689471,3562834943,3578832127,3579265535,3579267935,3579273215,3641241599,3641240575,3645019135,3645569023,3648479231);
        
    $IP106 = array(1404043264,2197028864);
        
    $IP206 = array(1405091839,2197094399);
        
    $IP107 = array(3650368512);
        
    $IP207 = array(3650368767);
        
    $IP108 = array(3278955480,3278956288,3278960128);
        
    $IP208 = array(3278955515,3278956543,3278960383);
        
    $IP109 = array(1389383040,1432330240,3282161664,3282171904,3585171456);
        
    $IP209 = array(1389383167,1432334335,3282163711,3282173951,3585174271);
        
    $IP110 = array(1346736128,3260286336,3645731072);
        
    $IP210 = array(1346737151,3260286463,3645731079);
        
    $IP111 = array(3648294912);
        
    $IP211 = array(3648295935);
        
    $IP112 = array(1481787392,3652001536);
        
    $IP212 = array(1481787647,3652001599);
        
    $IP113 = array(1052193280,1347125248,1347125248,1347126528);
        
    $IP213 = array(1052193535,1347129343,1347125759,1347127167);
        
    $IP114 = array(1358118912,1358119680);
        
    $IP214 = array(1358119423,1358123007);
        
    $IP115 = array(1406740480,1406741504,3564593152,3564595968,3564599808,3565248512,3565250048,3565250560,3578853376,3648215680);
        
    $IP215 = array(1406741503,1406743551,3564593407,3564596735,3564601343,3565256703,3565250559,3565254655,3578854079,3648215807);
        
    $IP116 = array(3651751936,3651752192,3651755008);
        
    $IP216 = array(3651752191,3651752447,3651756031);
        
    $IP117 = array(3287244288);
        
    $IP217 = array(3287244543);
        
    $IP118 = array(3645317120);
        
    $IP218 = array(3645318015);
        
    $IP119 = array(3268669440);
        
    $IP219 = array(3268673535);
        
    $IP120 = array(2197028864);
        
    $IP220 = array(2197094399);
        
    $IP121 = array(3588390912,1410269184);
        
    $IP221 = array(3588391935,1410334719);
        
    $IP122 = array(3266322432);
        
    $IP222 = array(3266322687);
        
    $IP123 = array(2197028864);
        
    $IP223 = array(2197094399);
        
    $IP124 = array(2197028864);
        
    $IP224 = array(2197094399);
        
    $IP125 = array(3562882304);
        
    $IP225 = array(3563086079);
        
    $IP127 = array(3563086079);
        
    $IP300 = array(3240705024);
        
    $IP301 = array(3240706047);
        
    $IP302 = array(1358905344,1358905344,1358907392,1358907648,1358907904,1358908160,1358908416,1358908672,1358908928,1358909184,1490436096);
        
    $IP303 = array(1358909439,1358905471,1358907647,1358907903,1358908159,1358908415,1358908671,1358908927,1358909183,1358909439,1490444287);
        
    $IP304 = array(3560612352,3560612864);
        
    $IP305 = array(3560612863,3560613887);
        
    $IP306 = array(3253698560);
        
    $IP307 = array(3253699071);
        
    $IP308 = array(3274702592);
        
    $IP309 = array(3274702847);
        
    $IP310= array(3557661440,3563233536,3583086592);
        
    $IP311 = array(3557661695,3563233791,3583087103);

        
    $IP312= array(1410273024,3588391680,2197079040,3588406784,3588407040);
        
    $IP313 = array(1410273279,3588391935,2197079295,3588407039,3588407295);

            for (
    $ix=0$ix<count($IP101); $ix++)
        {
            if (
    $ipnum>=$IP101[$ix] && $ipnum<=$IP201[$ix]) $oper "1";
        }
        for (
    $ix=0$ix<count($IP102); $ix++)
        {
            if (
    $ipnum>=$IP102[$ix] && $ipnum<=$IP202[$ix]) $oper "2";
        }
        for (
    $ix=0$ix<count($IP103); $ix++)
        {
            if (
    $ipnum>=$IP103[$ix] && $ipnum<=$IP203[$ix]) $oper "3";
        }
        for (
    $ix=0$ix<count($IP104); $ix++)
        {
            if (
    $ipnum>=$IP104[$ix] && $ipnum<=$IP204[$ix]) $oper "4";
        }
        for (
    $ix=0$ix<count($IP105); $ix++)
        {
            if (
    $ipnum>=$IP105[$ix] && $ipnum<=$IP205[$ix]) $oper "5";
        }
        for (
    $ix=0$ix<count($IP106); $ix++)
        {
            if (
    $ipnum>=$IP106[$ix] && $ipnum<=$IP206[$ix]) $oper "6";
        }
        for (
    $ix=0$ix<count($IP107); $ix++)
        {
            if (
    $ipnum>=$IP107[$ix] && $ipnum<=$IP207[$ix]) $oper "7";
        }
        for (
    $ix=0$ix<count($IP108); $ix++)
        {
            if (
    $ipnum>=$IP108[$ix] && $ipnum<=$IP208[$ix]) $oper "8";
        }
        for (
    $ix=0$ix<count($IP109); $ix++)
        {
            if (
    $ipnum>=$IP109[$ix] && $ipnum<=$IP209[$ix]) $oper "9";
        }
        for (
    $ix=0$ix<count($IP110); $ix++)
        {
            if (
    $ipnum>=$IP110[$ix] && $ipnum<=$IP210[$ix]) $oper "10";
        }
        for (
    $ix=0$ix<count($IP111); $ix++)
        {
            if (
    $ipnum>=$IP111[$ix] && $ipnum<=$IP211[$ix]) $oper "11";
        }
        for (
    $ix=0$ix<count($IP112); $ix++)
        {
            if (
    $ipnum>=$IP112[$ix] && $ipnum<=$IP212[$ix]) $oper "12";
        }
        for (
    $ix=0$ix<count($IP113); $ix++)
        {
            if (
    $ipnum>=$IP113[$ix] && $ipnum<=$IP213[$ix]) $oper "13";
        }
        for (
    $ix=0$ix<count($IP114); $ix++)
        {
            if (
    $ipnum>=$IP114[$ix] && $ipnum<=$IP214[$ix]) $oper "14";
        }
        for (
    $ix=0$ix<count($IP115); $ix++)
        {
            if (
    $ipnum>=$IP115[$ix] && $ipnum<=$IP215[$ix]) $oper "15";
        }
        for (
    $ix=0$ix<count($IP116); $ix++)
        {
            if (
    $ipnum>=$IP116[$ix] && $ipnum<=$IP216[$ix]) $oper "16";
        }
        for (
    $ix=0$ix<count($IP117); $ix++)
        {
            if (
    $ipnum>=$IP117[$ix] && $ipnum<=$IP217[$ix]) $oper "17";
        }
        for (
    $ix=0$ix<count($IP118); $ix++)
        {
            if (
    $ipnum>=$IP118[$ix] && $ipnum<=$IP218[$ix]) $oper "18";
        }
        for (
    $ix=0$ix<count($IP119); $ix++)
        {
            if (
    $ipnum>=$IP119[$ix] && $ipnum<=$IP219[$ix]) $oper "19";
        }
        for (
    $ix=0$ix<count($IP120); $ix++)
        {
            if (
    $ipnum>=$IP120[$ix] && $ipnum<=$IP220[$ix]) $oper "20";
        }
        for (
    $ix=0$ix<count($IP121); $ix++)
        {
            if (
    $ipnum>=$IP121[$ix] && $ipnum<=$IP221[$ix]) $oper "21";
        }
        for (
    $ix=0$ix<count($IP122); $ix++)
        {
            if (
    $ipnum>=$IP122[$ix] && $ipnum<=$IP222[$ix]) $oper "22";
        }
        for (
    $ix=0$ix<count($IP123); $ix++)
        {
            if (
    $ipnum>=$IP123[$ix] && $ipnum<=$IP223[$ix]) $oper "23";
        }
        for (
    $ix=0$ix<count($IP124); $ix++)
        {
            if (
    $ipnum>=$IP124[$ix] && $ipnum<=$IP224[$ix]) $oper "24";
        }
        for (
    $ix=0$ix<count($IP125); $ix++)
        {
            if (
    $ipnum>=$IP125[$ix] && $ipnum<=$IP225[$ix]) $oper "25";
        }
        for (
    $ix=0$ix<count($IP300); $ix++)
        {
        if (
    $ipnum>=$IP300[$ix] && $ipnum<=$IP301[$ix]) $oper "26";
        }
        for (
    $ix=0$ix<count($IP302); $ix++)
        {
        if (
    $ipnum>=$IP302[$ix] && $ipnum<=$IP303[$ix]) $oper "27";
        }
        for (
    $ix=0$ix<count($IP304); $ix++)
        {
        if (
    $ipnum>=$IP304[$ix] && $ipnum<=$IP305[$ix]) $oper "28";
        }
        for (
    $ix=0$ix<count($IP306); $ix++)
        {
        if (
    $ipnum>=$IP306[$ix] && $ipnum<=$IP307[$ix]) $oper "29";
        }
        for (
    $ix=0$ix<count($IP308); $ix++)
        {
        if (
    $ipnum>=$IP308[$ix] && $ipnum<=$IP309[$ix]) $oper "30";
        }
        for (
    $ix=0$ix<count($IP310); $ix++)
        {
        if (
    $ipnum>=$IP310[$ix] && $ipnum<=$IP311[$ix]) $oper "30";
        }
        for (
    $ix=0$ix<count($IP312); $ix++)
        {
        if (
    $ipnum>=$IP312[$ix] && $ipnum<=$IP313[$ix]) $oper "31";
        }

    }

    if(
    $oper == 1)$oper_name "Мегафон";
    if(
    $oper == 2)$oper_name "Билайн";
    if(
    $oper == 3)$oper_name "Utel";
    if(
    $oper == 4)$oper_name "БайкалВестКом";
    if(
    $oper == 5)$oper_name "МТС";
    if(
    $oper == 6)$oper_name "TELE2";
    if(
    $oper == 7)$oper_name "МОТИВ";
    if(
    $oper == 8)$oper_name "Енисейтелеком";
    if(
    $oper == 9)$oper_name "НСС";
    if(
    $oper == 10)$oper_name "СМАРТС";
    if(
    $oper == 11)$oper_name "СТЕК GSM";
    if(
    $oper == 12)$oper_name "Татинком-Т";
    if(
    $oper == 13)$oper_name "Ульяновск GSM";
    if(
    $oper == 14)$oper_name "НТК";
    if(
    $oper == 15)$oper_name "СКАЙЛИНК";
    if(
    $oper == 16)$oper_name "Цифровая экспансия";
    if(
    $oper == 17)$oper_name "ИНДИГО";
    if(
    $oper == 18)$oper_name "Emt (Эстония)";
    if(
    $oper == 19)$oper_name "Elisa (Эстония)";
    if(
    $oper == 20)$oper_name "Tele-2 (Эстония)";
    if(
    $oper == 21)$oper_name "Bite (Литва)";
    if(
    $oper == 22)$oper_name "Omnitel (Литва)";
    if(
    $oper == 23)$oper_name "Tele-2 (Литва)";
    if(
    $oper == 24)$oper_name "Tele-2 (Латвия)";
    if(
    $oper == 25)$oper_name "Lmt (Латвия)";
    if(
    $oper == 26)$oper_name "Киевстар";
    if(
    $oper == 27)$oper_name "UMC";
    if(
    $oper == 28)$oper_name "life:)";
    if(
    $oper == 29)$oper_name "WellCOM (Билайн)";
    if(
    $oper == 30)$oper_name "KCELL";
    if(
    $oper == 31)$oper_name "Прибалтийские операторы";
    ?>
    з.ы. Заренее спасибо!
     
  2. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    вот полный скрипт http://viptraf.net/script.zip
     
  3. Impuls*

    Impuls* Elder - Старейшина

    Joined:
    3 Oct 2007
    Messages:
    75
    Likes Received:
    6
    Reputations:
    -1
    Не хочу показаться наглым, но все же :)
    Какая карьера, если ты тут не разбираешься...а вдруг тебе еще что посложнее дадут, то ты опять в форум будешь просить помощи?? ;)
    P.s. не знаю точно, но здесь подобные просьбы решают за $ ))
     
  4. DRON-ANARCHY

    DRON-ANARCHY Отец порядка

    Joined:
    4 Mar 2005
    Messages:
    716
    Likes Received:
    142
    Reputations:
    50
    какой вы, батенька, меркантильный человек...
    а добавлять вроде не особо сложно. По аналогии с другими
     
  5. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Да я не пхп кодер.у меня стоит этот клик клуб.на сайте было голосование насчет того чтобы включить оперу мини.все согласились, а вот добавить ее мы не можем.если до понедельника не будет добавлена опера то мне капец.помогите пожалуйста!
     
  6. Impuls*

    Impuls* Elder - Старейшина

    Joined:
    3 Oct 2007
    Messages:
    75
    Likes Received:
    6
    Reputations:
    -1
    Насколько я знаю, опера не передает информацию о пользователе, кроме самого браузера :)
     
  7. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Она передает ип адрес сервера.вот именно его и надо прописать
     
  8. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    195.189.142.***
    у меня с мини оперы обычно такой ип
     
  9. Impuls*

    Impuls* Elder - Старейшина

    Joined:
    3 Oct 2007
    Messages:
    75
    Likes Received:
    6
    Reputations:
    -1
    Дак посмотри на примеры в своем же коде.
    Там же в массивах диапазоны указаны. Я бы тебе помог, будь я опытнее в php и если бы время было)))
     
  10. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Так я в пхп ниче не понимаю
     
  11. ant0ha

    ant0ha Elder - Старейшина

    Joined:
    22 May 2007
    Messages:
    130
    Likes Received:
    50
    Reputations:
    13
    Тут самое главное их диапазоны IP узнать, а дальше уже делать по аналогии с другими, что особой сложности не представляет

    ЗЫ:
    PHP:
    12: if($oper or $oper>25)
    Почему 25, если у тебя их там 31?
     
  12. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Я хз.скрипт не я писал.я вобще пхп не знаю, по этому и прошу здесь помощи.а ип их ний я писал на 1ой стр
     
  13. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    А куда там хоть диапазон ип вписывать?
     
  14. ant0ha

    ant0ha Elder - Старейшина

    Joined:
    22 May 2007
    Messages:
    130
    Likes Received:
    50
    Reputations:
    13
    Тогда к примеру если у них диапазон от 195.189.142.0 - 195.189.142.255

    Видим:
    PHP:
    @$ipnum $ips[3] + $ips[2] * 256 $ips[1] * 256 256 $ips[0] * 256 256 256;
    $ips[0] – 195
    $ips[1] – 189
    $ips[2] – 142
    $ips[3] – 0 и 255

    Посчитав формулу получаем два числа: 3283979776 и 3283980031

    Добавляем после
    PHP:
     $IP312= array(1410273024,3588391680,2197079040,3588406784,  3588407040);
     
    $IP313 = array(1410273279,3588391935,2197079295,3588407039,  3588407295);
    это
    PHP:
    $IP132 = array(3283979776);
    $IP232 = array(3283980031);
    после
    PHP:
        for ($ix=0$ix<count($IP312); $ix++)
        {
        if (
    $ipnum>=$IP312[$ix] && $ipnum<=$IP313[$ix]) $oper "31";
        }
    это
    PHP:
        for ($ix=0$ix<count($IP132); $ix++)
        {
        if (
    $ipnum>=$IP132[$ix] && $ipnum<=$IP232[$ix]) $oper "32";
        }
    и после этого
    PHP:
    if($oper == 31)$oper_name "Прибалтийские операторы";
    вот это
    PHP:
    if($oper == 32)$oper_name "Опера";
    вроде так

    и вместо 25 поставь 32, то о чем я писал постом выше
     
  15. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Спасиб.тока я нифига не понял.буду щя разбираться...
     
  16. ant0ha

    ant0ha Elder - Старейшина

    Joined:
    22 May 2007
    Messages:
    130
    Likes Received:
    50
    Reputations:
    13
    Подробней уже помойму писать некуда =\
     
  17. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    А если надо довавить несколько диапазонов относящихся к одному оператору?
     
  18. ant0ha

    ant0ha Elder - Старейшина

    Joined:
    22 May 2007
    Messages:
    130
    Likes Received:
    50
    Reputations:
    13
    Высчитываешь два числа по формуле и добавляешь в массив через запятую
    PHP:
     $IP132 = array(3283979776xxxxxxxxx1xxxxxxxxxx2);
    $IP232 = array(3283980031yyyyyyyyyyyy1yyyyyyyyyy2);  
    меньшее число в первый массив, большее во второй
     
  19. Haruka

    Haruka Elder - Старейшина

    Joined:
    25 Jul 2007
    Messages:
    48
    Likes Received:
    5
    Reputations:
    -1
    Спасиба!