PDA

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


Haruka
21.10.2007, 11:37
Немогу разобраться как добавить в скрипт клик клуба новых операторов. Помогите пожалуйста! Мне надо срочно до понедельника, от этого зависит моя карьера!!
Вот скрипт:

<?
if (eregi("oper.php",$PHP_SELF))
{
//Header("Location: index.php");
die();
}
$oper= trim(htmlspecialchars(stripslashes(@$_GET['oper'])));
$oper = @preg_replace("/[^0-9]/", "", $oper);

if($oper != "")
{
if($oper < 0 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,325123 3792,3582031776);
$IP201 = array(2130706687,1402275839,1402278911,1402280959, 1402283007,1402285055,1402287103,1402288127,325123 4815,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,356467 6832,3571187712,3641816064,3641816576);
$IP203 = array(1047072255,1401450751,1401451775,1406869503, 1425994239,1441371903,3272364799,3564683263,356467 6863,3571253247,3641816319,3641816831);
$IP104 = array(1347599104,3588519936);
$IP204 = array(1347599359,3588520447);
$IP105 = array(1042394624,1346950400,1347674112,1360933376, 1372794624,1410457600,3258356736,3277188608,328146 5344,3287259392,3559689216,3562834880,3578831872,3 579259392,3579267072,3579269120,3641237504,3641237 504,3645018112,3645566976,3648478720);
$IP205 = array(1042394879,1346950655,1347678207,1360933887, 1372794879,1410459647,3258357759,3277188863,328146 5599,3287259647,3559689471,3562834943,3578832127,3 579265535,3579267935,3579273215,3641241599,3641240 575,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,357885 3376,3648215680);
$IP215 = array(1406741503,1406743551,3564593407,3564596735, 3564601343,3565256703,3565250559,3565254655,357885 4079,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,135890 8928,1358909184,1490436096);
$IP303 = array(1358909439,1358905471,1358907647,1358907903, 1358908159,1358908415,1358908671,1358908927,135890 9183,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 = "Прибалтийские операторы";
?>


з.ы. Заренее спасибо!

Haruka
21.10.2007, 11:46
вот полный скрипт http://viptraf.net/script.zip

Impuls*
21.10.2007, 12:03
Не хочу показаться наглым, но все же :)
Какая карьера, если ты тут не разбираешься...а вдруг тебе еще что посложнее дадут, то ты опять в форум будешь просить помощи?? ;)
P.s. не знаю точно, но здесь подобные просьбы решают за $ ))

DRON-ANARCHY
21.10.2007, 12:37
какой вы, батенька, меркантильный человек...
а добавлять вроде не особо сложно. По аналогии с другими

Haruka
21.10.2007, 12:45
Да я не пхп кодер.у меня стоит этот клик клуб.на сайте было голосование насчет того чтобы включить оперу мини.все согласились, а вот добавить ее мы не можем.если до понедельника не будет добавлена опера то мне капец.помогите пожалуйста!

Impuls*
21.10.2007, 12:52
Насколько я знаю, опера не передает информацию о пользователе, кроме самого браузера :)

Haruka
21.10.2007, 12:55
Она передает ип адрес сервера.вот именно его и надо прописать

Haruka
21.10.2007, 12:58
195.189.142.***
у меня с мини оперы обычно такой ип

Impuls*
21.10.2007, 13:07
Дак посмотри на примеры в своем же коде.
Там же в массивах диапазоны указаны. Я бы тебе помог, будь я опытнее в php и если бы время было)))

Haruka
21.10.2007, 13:10
Так я в пхп ниче не понимаю

ant0ha
21.10.2007, 13:23
Тут самое главное их диапазоны IP узнать, а дальше уже делать по аналогии с другими, что особой сложности не представляет

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

Haruka
21.10.2007, 13:30
Я хз.скрипт не я писал.я вобще пхп не знаю, по этому и прошу здесь помощи.а ип их ний я писал на 1ой стр

Haruka
21.10.2007, 13:51
А куда там хоть диапазон ип вписывать?

ant0ha
21.10.2007, 13:56
Тогда к примеру если у них диапазон от 195.189.142.0 - 195.189.142.255

Видим:@$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

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

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

Haruka
21.10.2007, 14:00
Спасиб.тока я нифига не понял.буду щя разбираться...

ant0ha
21.10.2007, 14:03
Подробней уже помойму писать некуда =\

Haruka
21.10.2007, 14:11
А если надо довавить несколько диапазонов относящихся к одному оператору?

ant0ha
21.10.2007, 14:29
Высчитываешь два числа по формуле и добавляешь в массив через запятую $IP132 = array(3283979776, xxxxxxxxx1, xxxxxxxxxx2);
$IP232 = array(3283980031, yyyyyyyyyyyy1, yyyyyyyyyy2); меньшее число в первый массив, большее во второй

Haruka
21.10.2007, 14:44
Спасиба!