Различные вопросы по PHP и MySQL

245K
.
$act = isset($_GET['act']) ? trim($_GET['act']) : '';
$act = in_array($act, array('add', 'edit', 'remove', 'view')) ? $act : 'view';
if (is_file('./' . $act . '.php')) {
    require './' . $act . '.php';
} else {
    exit('404/Not Found');
}
.
seg0ro, Спасибо
.
Screamer (28.01.2013 / 20:00)
[php]$act = isset($_GET['act']) ? trim($_GET['act']) : '';
$act = in_array($act, array('add', 'edit', 'remove', 'view')) ? $act : 'view';
if (is_file('./' . $act . '.php')) {
require './' . $ac
это уже больше на роутер похоже!
.
Fenixrus, ОМГ, гг, такой вариант гораздо удобнее, можно например не использовать массив а заюзать конфиг, чем плодить тысячи кейсов
.
скажите пожалуйста я с одного сайта взял скрипт admin.php а функции его не работают например добавить игрока в магазин, надо забить под свой сайт? как это сделать?
.
Screamer (28.01.2013 / 20:29)
Fenixrus, ОМГ, гг, такой вариант гораздо удобнее, можно например не использовать массив а заюзать конфиг, чем плодить тысячи кейсов
Или так :
index.php:
define('_IN_JOHNCMS', 1);
$rootpath = '../';
$headmod = 'qchat';
require_once ('../incfiles/core.php');
$path=realpath('./includes');
$files=array_diff(scandir($path),array('.', '..'));
foreach ($files as $file){
if (is_file($path . '/' . $file)){
$file=explode('.',$file);
$array[$file[0]]=$path;
}}
$textl='заголовок';
require_once ('../incfiles/head.php');
if (array_key_exists($act, $array)){
require_once($path . '/' . $act . '.php');
}else{
//здесь php код страницы
require_once ('../incfiles/end.php');
}
.
I'm the Cult of Personality...
привет всем. Хотел создать табличку. Но она незаливаетса в базу

//таблица
CREATE TABLE `xrey_otchet` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`chit` int(1) NOT NULL,
`user` VARCHAR(50) NOT NULL,
`tema` VARCHAR(100) NOT NULL,
`text` VARCHAR(255) NOT NULL,
`time` int(25) NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

//ошибка
Вывод команды: ERROR 1075 (42000) at line 1: Incorrect table definition; there can be only one auto column and it must be defined as a key

Помогиете. Очень нужна ета таблица.
.
Менделеев
CREATE TABLE `xrey_otchet` (
`id` int(10) NOT NULL AUTO_INCREMENT primary key,
`chit` int(1) NOT NULL,
`user` VARCHAR(50) NOT NULL,
`tema` VARCHAR(100) NOT NULL,
`text` VARCHAR(255) NOT NULL,
`time` int(25) NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
.
I'm the Cult of Personality...
fanatos, спасиб
.
Think different
Fenixrus (29.01.2013 / 05:32)
Или так :
index.php:
define('_IN_JOHNCMS', 1);
$rootpath = '../';
$headmod = 'qchat';
require_once ('../incfiles/core.php');
$path=realpath('./includes');
$files=array_diff(scandir($path),array
ОМГ
Всего: 7969