Просмотр поста

.
brendi

vermas, Вот у меня есть но он не работает почему то...

case "new":
            if (isset($_POST['submit'])) {


                $name = (trim($_POST['name']));
                $priz = (int)$_POST['priz'];
                $time = (int)$_POST['time'];
                $max_lvl = (int)$_POST['max_lvl'];

                if (!$name || !$priz || !$time || !$max_lvl) {
                    echo display_error('Пустые параметры!');
                    require_once ("../incfiles/end.php");
                    exit;
                }


                $handle = new upload($_FILES['imagefile']);
                if ($handle->uploaded) {
                    // Обрабатываем фото
                    $handle->file_new_name_body = $realtime;
                    //$handle->mime_check = false;
                    $handle->allowed = array('image/jpeg', 'image/gif', 'image/png');
                    $handle->file_max_size = 1024 * $set['flsz'];
                    $handle->file_overwrite = true;
                    $handle->image_resize = true;
                    $handle->image_x = 100;
                    $handle->image_ratio_y = true;
                    $handle->image_convert = 'jpg';
                    $handle->process('img/');
                    if ($handle->processed) {
                        // Обрабатываем превьюшку
                        $handle->file_new_name_body = $realtime . '_small';
                        $handle->file_overwrite = true;
                        $handle->image_resize = true;
                        $handle->image_x = 32;
                        $handle->image_ratio_y = true;
                        $handle->image_convert = 'jpg';
                        $handle->process('img/');
                        if ($handle->processed) {
		mysql_query("INSERT INTO fan_clubs SET id_lider='". $_POST['priz'] ."', img='". $realtime ."', name='".mysql_real_escape_string(mb_substr(trim($_POST['name']),0, 64))."', info='".$max_lvl."';");
                            header("Location: index.php");
                        } else {
                            echo display_error($handle->error);
                        }
                    } else {
                        echo display_error($handle->error);
                    }
                    $handle->clean();
                }
            } else {
                echo '<form enctype="multipart/form-data" action="?act=new" method="post">';
                echo '<div class="gmenu">';
                echo '<table cellpadding="2" cellspacing="0"><tr>';

                echo '<td><b>Имя</b></td><td><input type="text" name="name"  value="Кубок"/></td></tr><tr>';
                echo '<td><b>Дата</b></td><td><small>00.00.0000 00:00</small><br/><input type="text" name="time"  value="11.11.2011 10:00"/></td></tr><tr>';
                echo '<td><b>Приз</b></td><td><input type="text" name="priz"  value="5000"/></td></tr><tr>';
                echo '<td><b>Уровень</b></td><td><input type="text" name="max_lvl"  value="1"/></td></tr><tr>';
                echo '<td><b>Изображение</b></td><td><input type="file" name="imagefile" value="" /></td></tr><tr>';

                echo '</tr>';
                echo '</table>';

                echo '<p><input type="submit" name="submit" value="Добавить" /></p></div></form>';


            }


break;