vave
Полезный
- Регистрация
- 22 Июн 2007
- Сообщения
- 467
- Реакции
- 16
- Автор темы
- #1
Прописал $cat = $_GET[category];
Но работает только тут
А тут работать не хочет
И так тоже не достается category
Но работает только тут
PHP:
if($cat == 'shop') {
include('addshop.php');
} else {
include('addalbum.php');
}
А тут работать не хочет
PHP:
header ('location:cp-list-photos.php?id=' . $listid . '&add=true' . '&category=' . $cat);
}
И так тоже не достается category
PHP:
header ('location:cp-list-photos.php?id=' . $listid . '&add=true' . '&category=' . $_GET[category]);
}
PHP:
<?
if ($demo)
{
$dis = 'disabled=\'disabled\'';
}
else
$cat = $_GET[category];
{
$dis = '';
}
$page_titl = 'Add Listing';
$page_desc = '';
$page_keys = '';
$page_this = 'l';
$page_mode = 'la';
$page_subn = 'a';
$path_root = '';
$link = mysql_connect ($dbhost, $dbuser, $dbpass);
mysql_select_db ($dbname, $link);
$result = mysql_query ('SELECT * FROM ' . $dbconf, $link);
$conf = mysql_fetch_array ($result);
$conf = safe_data ($conf, 'display');
if ($_SESSION[c2][maxlist] <= $_SESSION[c2][listings])
{
if ($_SESSION[c2][maxlist] != 0)
{
header ('location:cp-list-index.php' . '&category='. $cat);
}
}
if ($_POST[submit])
{
if (!($demo))
{
$_POST = safe_data ($_POST, 'query');
if (!($_POST[userid]))
{
$error .= 'Please select a <b>User</b> to assign this listing to.<br/>';
}
if (!($_POST[make]))
{
$error .= 'Please select a <b>Make</b> for this listing.<br/>';
}
if (!($error))
{
if ($_POST[month])
{
if ($_POST[day])
{
if ($_POST[year])
{
$expire = mktime (1, 0, 0, $_POST[month], $_POST[day], $_POST[year]);
}
}
}
if ($_POST[mileage])
{
$_POST[mileage] = price ($_POST[mileage]);
}
if ($_POST[price])
{
$_POST[price] = price ($_POST[price]);
}
if ($_POST[sale])
{
$_POST[sale] = price ($_POST[sale]);
}
$result = mysql_query ('SELECT user_type,expire FROM ' . $dbacct . ' WHERE id=\'' . $_POST['userid'] . '\' LIMIT 1', $link);
$row = mysql_fetch_array ($result);
if (!(mysql_query ('INSERT INTO ' . $dblist . ' VALUES(\'0\',
\'' . $_POST['userid'] . '\',
\'' . $_POST['location'] . '\',
\'' . $row['type'] . '\',
\'' . time () . '\',
\'' . time () . ('\',
\'' . $expire . '\',
\'' . $row['expire'] . '\',
\'0\',
\'0\',
\'' . $_POST['hide'] . '\',
\'' . $_POST['featured'] . '\',
\'' . $_POST['status'] . '\',
\'1\',
\'' . $_POST['stock'] . '\',
\'' . $_POST['vin'] . '\',
\'' . $_POST['model_year'] . '\',
\'' . $_POST['make'] . '\',
\'' . $_POST['model'] . '\',
\'' . $_POST['cond'] . '\',
\'' . $_POST['category'] . '\',
\'' . $_POST['category2'] . '\',
\'' . $_POST['mileage'] . '\',
\'' . $_POST['mileage_alt'] . '\',
\'' . $_POST['price'] . '\',
\'' . $_POST['sale'] . '\',
\'' . $_POST['price_alt'] . '\',
\'' . $_POST['exterior'] . '\',
\'' . $_POST['interior'] . '\',
\'' . $_POST['doors'] . '\',
\'' . $_POST['fuel'] . '\',
\'' . $_POST['drive'] . '\',
\'' . $_POST['engine'] . '\',
\'' . $_POST['trans'] . '\',
\'' . $_POST['top_speed'] . '\',
\'' . $_POST['horsepower'] . '\',
\'' . $_POST['torque'] . '\',
\'' . $_POST['towing'] . '\',
\'' . $_POST['features'] . '\',
\'' . $_POST['description'] . '\',
\'' . $_POST['tagline'] . '\',
\'' . $_POST['link_url'] . '\',
\'' . $_POST['link_text'] . '\',
\'' . $_POST['ebay_url'] . '\')'), $link)))
{
exit (mysql_error ());
}
$listid = mysql_insert_id ($link);
$cat = $_GET[category];
if (!(mysql_query ('UPDATE ' . $dbacct . ' SET listings=listings+1 WHERE id=\'' . $_POST['userid'] . '\' LIMIT 1', $link)))
{
exit (mysql_error ());
}
if ($_POST[userid] == $_SESSION[c2][userid])
{
++$_SESSION[c2][listings];
}
if (!(mysql_query ('UPDATE ' . $dbloca . ' SET listings=listings+1 WHERE id=\'' . $_POST['location'] . '\' LIMIT 1', $link)))
{
exit (mysql_error ());
}
if (!(mysql_query ('INSERT INTO ' . $dbfeat . ' (id) VALUES(\'' . $listid . '\')', $link)))
{
exit (mysql_error ());
}
foreach ($_POST as $id => $value)
{
if (substr ($id, 0, 2) == 'cp')
{
$cat = $_GET[category];
if (!(mysql_query ('UPDATE ' . $dbfeat . ' SET ' . $id . '=\'' . $value . '\' WHERE id=\'' . $listid . '\' LIMIT 1', $link)))
{
exit (mysql_error ());
}
continue;
}
}
header ('location:cp-list-photos.php?id=' . $listid . '&add=true' . '&category='. $_GET[category]);
}
else
{
$_POST = safe_data ($_POST, 'display');
}
}
}
else
{
$_POST[userid] = $_SESSION[c2][userid];
$_POST[location] = $conf[location];
}
if ($_SESSION[c2][user_type] == 1)
{
if ($conf[user_mod])
{
$urestrict = '';
}
else
{
$urestrict = 'AND id=\'' . $_SESSION[c2][userid] . '\'';
}
}
else
{
if ($_SESSION[c2][user_type] == 2)
{
if ($conf[admin_mod])
{
$urestrict = '';
}
else
{
$urestrict = 'AND (id=\'' . $_SESSION[c2][userid] . '\' OR user_type=\'1\')';
}
}
else
{
$urestrict = '';
}
}
if ($_SESSION[c2][user_type] == 1)
{
if ($conf[user_expire])
{
$expire = true;
}
else
{
$expire = false;
}
}
else
{
if ($_SESSION[c2][user_type] == 2)
{
if ($conf[admin_expire])
{
$expire = true;
}
else
{
$expire = false;
}
}
else
{
$expire = true;
}
}
if ($_SESSION[c2][user_type] == 1)
{
if ($conf[user_feature])
{
$feature = true;
}
else
{
$feature = false;
}
}
else
{
if ($_SESSION[c2][user_type] == 2)
{
if ($conf[admin_feature])
{
$feature = true;
}
else
{
$feature = false;
}
}
else
{
$feature = true;
}
}
if ($_SESSION[c2][user_type] == 1)
{
if ($conf[user_hide])
{
$hide = true;
}
else
{
$hide = false;
}
}
else
{
if ($_SESSION[c2][user_type] == 2)
{
if ($conf[admin_hide])
{
$hide = true;
}
else
{
$hide = false;
}
}
else
{
$hide = true;
}
}
require 'cp-includes/inc-header.php';
require 'cp-includes/inc-navigation.php';
echo '
<div id=\'content\'>
<h1><span lang="ru">Add</span></h1>
';
if ($error)
{
echo '<div id=\'msg-error\'>' . $error . '</div>';
}
echo '
<form action=\'';
echo $_SERVER[PHP_SELF];
echo '\' method=\'post\'>
<div style="display:none;">
<select class=\'widtha\' id=\'userid\' name=\'userid\' tabindex=\'1\'>
';
$result = mysql_query ('SELECT id,CONCAT(first_name,\' \',last_name) AS name FROM ' . $dbacct . '
WHERE (maxlist=\'\' OR listings<maxlist OR id=\'' . $_POST['userid'] . '\') ' . $urestrict . ' ORDER BY name ASC', $link);
while ($row = mysql_fetch_array ($result))
{
$row = safe_data ($row, 'display');
echo '<option value=\'' . $row['id'] . '\'';
if ($row[id] == $_POST[userid])
{
echo ' selected=\'selected\'';
}
echo '>' . $row['name'] . '</option>';
}
echo ' </select>
<select class=\'widtha\' id=\'location\' name=\'location\' tabindex=\'2\'>
';
if ($_SESSION[c2][location])
{
$lrestrict = 'WHERE id=\'' . $_SESSION[c2][location] . ('\' OR id=\'' . $_POST['location'] . '\'');
}
$result = mysql_query ('SELECT id,name FROM ' . $dbloca . ' ' . $lrestrict . ' ORDER BY name ASC', $link);
while ($row = mysql_fetch_array ($result))
{
$row = safe_data ($row, 'display');
echo '<option value=\'' . $row['id'] . '\'';
if ($row[id] == $_POST[location])
{
echo ' selected=\'selected\'';
}
echo '>' . $row['name'] . '</option>';
}
echo ' </select>
<select class=\'widtha\' id=\'status\' name=\'status\' tabindex=\'3\'>
';
for ($n = 1; $n <= 3; ++$n)
{
echo '<option value=\'' . $n . '\'';
if ($n == $_POST[status])
{
echo ' selected=\'selected\'';
}
echo '>' . $status[$n] . '</option>';
}
echo ' </select></div>';
if($cat == 'shop') {
include('addshop.php');
} else {
include('addalbum.php');
}
echo '<br><br><input class=\'button\' type=\'submit\' name=\'submit\' value=\'Submit Listing\' ';
echo $dis;
echo '/>
</form>
</div>
';
?>