Помогите разобраться в коде, после дезенда.

A
На сайте с 18.02.2009
Offline
46
488

Собственно дезенд отработал на ура, но маленькие косячки есть, вот кусок кода:

    if ( $_GET['ganr'] != "0" || $_GET['strana'] != "0" )

{
$i = 0;
КОСЯК for ( ; do
{
КОСЯК $i < count( $temp ); ++$i )
{
static $last = "";
if ( $temp[$i]['id_film'] == $last )
{
$temp1[] = $temp[$i];
}
else
{
$last = $temp[$i]['id_film'];
}
break;
}
} while ( 1 );
}
else
{
$temp1 = $temp;
}
$where = " where ";
$i = 0;
И тут наверное КОСЯК for ( ; $i < count( $temp1 ); ++$i )
{
$where .= "(ok='1' and id='".$temp1[$i]['id_film']."')";
if ( $i < count( $temp1 ) - 1 )
{
$where .= " or ";
}
}
Аккаунты на торрент-трекеры. () Тут дают деньги!!! (http://Pop-Bazar.com/registration.php?ref=2115)
Хорс
На сайте с 14.12.2010
Offline
21
#1

Замени ***91; на [ и ***93; на ]

А то нихрена не понятно 🤪

A
На сайте с 18.02.2009
Offline
46
#2

Готово, исправил.

Хорс
На сайте с 14.12.2010
Offline
21
#3

Попробуй так:


<?php

if ( $_GET['ganr'] != "0" || $_GET['strana'] != "0" )
{
for ($i = 0; $i < count( $temp ); ++$i )
{
do
{
static $last = "";
if ( $temp[$i]['id_film'] == $last )
$temp1[] = $temp[$i];
else
$last = $temp[$i]['id_film'];
break;
} while ( true );
}
}
else
{
$temp1 = $temp;
}
$where = " where ";

for ($i = 0; $i < count( $temp1 ); ++$i )
{
$where .= "(ok='1' and id='".$temp1[$i]['id_film']."')";
if ( $i < count( $temp1 ) - 1 )
{
$where .= " or ";
}
}

Правда не совсем понятна цель этого кода 🤪

A
На сайте с 18.02.2009
Offline
46
#4

Хорс, благодарю.

C
На сайте с 04.02.2005
Offline
291
#5

do

{
static $last = "";
if ( $temp[$i]['id_film'] == $last )
$temp1[] = $temp[$i];
else
$last = $temp[$i]['id_film'];
break;
} while ( true );

Тут даже цикл do не нужен

		if ( $temp[$i]['id_film'] == $last )

$temp1[] = $temp[$i];
else
$last = $temp[$i]['id_film'];

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий