Файл: public_html/tmp/inc/mode.editor.php
Строк: 47
<?php
#by FeST
#ICQ : 3452223
#Действия с таблицами
$table=chek($_GET['table']);
$column=chek($_GET['column']);
        
         if(isset($_GET['del']))
             echo "<div class='msg'>Вы действительно хотите удалить данное поле?<br/><a href='index.php?table=".$table."&mode=editor&column=".$column."&delete'>Да</a>|<a href='index.php?table=".$table."&mode=editor&column=".$column."'>Нет</a></div>";
        if(isset($_GET['delete'])){
        mysql_query("ALTER TABLE `".$table."` DROP `".$column."`");
        header("Location:index.php?table=".$table."&mode=structure");
        exit;
        }
        
        
        if(isset($_GET['yes']))header("Location:index.php?table=".$table."&mode=structure");
        echo "Поле: "<b>".$column."</b>"<br/>";
        $query='SHOW FULL FIELDS FROM '.$table.' LIKE '' . $column . '';';
        $arr = mysql_query($query); 
        if(!$arr) echo "Произошла ошибка: ".mysql_error(); else{
    
            $res=mysql_fetch_array($arr);
                if(isset($_POST['submit'])){
                $column_name=$_POST['column'];
                $type=$_POST['type'];
                $coll=$_POST['coll'];
                
                if(!empty($coll)){
                $ch=explode('_',$coll);
                
                $coll='CHARACTER SET '.$ch[0].' COLLATE '.$coll.'';
                }
                $sql="ALTER TABLE `".$table."` CHANGE `".$column."` `".$column_name."` ".$type." ".$coll." NOT NULL ";
                $a=mysql_query($sql);
                
                if($a)header("Location:index.php?table=".$table."&mode=editor&column=".$column."&sql_ok&yes");
                else
                header("Location:index.php?table=".$table."&mode=editor&column=".$column."&sql_no");
                exit;
                }
            
                $res[1]=strtoupper($res[1]);
                echo "<hr/>
                <form method='post' action='index.php?table=".$table."&mode=editor&column=".$column."&chek=".mt_rand()."'>
                Полe:<br/>
                <input name='column' value='".chek($column)."'/><br/>
                Тип:<br/>
                <input name='type' value='".chek($res[1])."'/>
                <br/>
                Кодировка:<br/>
                <input name='coll' value='".chek($res[2])."'/><br/>
                <input type='submit' name='submit' value='Сохранить'/>
                
                </form>
                <hr/>
                <b style='color:red;'>ВНИМАНИЕ!</b><br/> Не редактируйте то, чего не понимаете!<hr/>";
                
                
                }
                echo "» <a href='index.php?table=".$table."&mode=structure'>Назад</a><br/>";
            
            
            
?>