Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/12/2005, 23:14
braiank
 
Fecha de Ingreso: diciembre-2005
Mensajes: 249
Antigüedad: 18 años, 4 meses
Puntos: 0
Problema Con php

Bueno les comento que tengo un problema con un script .
el error es el siguiente :
Código:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\AppServ\www\totalguild.php on line 38
el php script es el siguiente :

Código:
<?php
$dir = 'D:\\DreaMServer2';
$top = 10;
$title_color = 'AACAF5';
$body_color = 'C6D8F6';

$glob = glob(($dir==''?'':$dir.'\\').'Character\\AscII*\\*.txt');

$name_arr = array();
$town_arr = array();
$lvl_arr = array();
$exp_arr = array();

for($i=0; $i<count($glob); $i++)
{
        $file = file($glob[$i]);
        for($a=0; $a<count($file); $a++)
        {
                if(preg_match('/character-name     =/', $file[$a]))
                $name = $a;
                elseif(preg_match('/character-location   =/', $file[$a]))
                $town = $a;
                elseif(preg_match('/character-LEVEL    =/', $file[$a]))
                $lvl = $a;
                elseif(preg_match('/character-EXP      =/', $file[$a]))
                $exp = $a;
        }
        $name = str_replace('character-name     = ', '', $file[$name]);
        $town = str_replace('character-location   = ', '', $file[$town]);
        $lvl = str_replace('character-LEVEL    = ', '', $file[$lvl]);
        $exp = str_replace('character-EXP      = ', '', $file[$exp]);

        $name_arr = array_merge($name_arr, $name);
        $town_arr = array_merge($town_arr, $town);
        $lvl_arr = array_merge($lvl_arr, $lvl);
        $exp_arr = array_merge($exp_arr, $exp);
}

array_multisort($lvl_arr, SORT_DESC, SORT_NUMERIC, $town_arr, $name_arr, $exp_arr);

echo '<style>
table {
        border-collapse:collapse; border:0;
        }
td {
        font-size: 13px; font-family: sans-serif; text-align:center;
        border-right:windowtext 0.5pt solid; border-top:windowtext 0.5pt solid; border-left:windowtext 0.5pt solid; border-bottom:windowtext 0.5pt solid;
        }
</style>
<table cellpadding=4>
<tr>
<td width=10% bgcolor="'.$title_color.'">
   Rating
</td>
<td width=30% bgcolor="'.$title_color.'">
   Name
</td>
<td width=20% bgcolor="'.$title_color.'">
   Level
</td>
<td width=40% bgcolor="'.$title_color.'">
   Experience
</td>
</tr>';

for($i=0; $i<$top; $i++)
{
        if(@$name_arr[$i])
        {
                if(trim($town_arr[$i]) == 'aresden')
                $color = 'red';
                elseif(trim($town_arr[$i]) == 'elvine')
                $color = 'blue';
                else
                $color = 'white';

                echo '<tr>
                <td style="color:'.$color.'" bgcolor="'.$body_color.'">
                   '.($i+1).'
                </td>
                <td style="color:'.$color.'" bgcolor="'.$body_color.'">
                   '.$name_arr[$i].'
                </td>
                <td style="color:'.$color.'" bgcolor="'.$body_color.'">
                   '.$lvl_arr[$i].'
                </td>
                <td style="color:'.$color.'" bgcolor="'.$body_color.'">
                   '.$exp_arr[$i].'
                </td>
                </tr>';
        }
}

echo '</table>';


?>
help ;)

Última edición por braiank; 28/12/2005 a las 23:22