示例#1
0
    die("Access denied");
}
if ($_SESSION['member']['gid'] == _ACL_REMOTE_CONTENT_) {
    header('Location: /adm/productadd/');
    exit;
}
$Page = new Page();
$Products = new Products();
if (isset($_POST['name_index_status'])) {
    require_once $GLOBALS['PATH_model'] . 'morphy.functions.php';
    $count = $Products->GetCountNameIndex();
    $total = 0;
    foreach ($count as $value) {
        $i = $value['id_product'];
        $name = $Products->GetName($i);
        $name_index = Words2BaseForm($name);
        $Products->Morphy($i, $name_index);
        $total++;
    }
    echo "<script>alert('Обработано записей: " . $total . ".');window.location.replace('" . $GLOBALS['URL_base'] . "adm');</script>";
}
// Пересчитать цены поставщиков по новому курсу
if (isset($_POST['kurs']) && isset($_POST['kurs_griwni'])) {
    if ($Products->UpdatePriceSupplierAssortiment($_POST['kurs_griwni'])) {
        echo "<script>alert('Цены пересчитаны');window.location.replace('" . $GLOBALS['URL_base'] . "adm');</script>";
    } else {
        echo "<script>alert('Что-то пошло не так');</script>";
    }
}
if (isset($GLOBALS['REQAR'][1]) && $GLOBALS['REQAR'][1] == 'random_seo_text') {
    $Seo = new Seo();
示例#2
0
ini_set('display_errors', '1');
setlocale(LC_ALL, 'ru_RU');
require_once 'morphy.functions.php';
if (!isset($_POST['host']) || !isset($_POST['user']) || !isset($_POST['password'])) {
    echo <<<HTML
<form action="update.php" method="POST" >
<input type="text" name="host" value="localhost">
<input type="text" name="user" value="root">
<input type="text" name="password" value="">
<input type="submit">
</form>
HTML;
} else {
    mysql_connect($_POST['host'], $_POST['user'], $_POST['password']) or die('Database: Failed to connect. Check your credentials.');
    mysql_set_charset('utf-8');
    mysql_select_db('xtorg_db') or die('Failed to select database');
    $min = 58000;
    $qry = "SELECT MAX(id_product) FROM xt_product";
    $result = mysql_fetch_array(mysql_query($qry)) or die(mysql_error());
    $max = 58250;
    $total = 0;
    for ($i = $min; $i <= $max; $i++) {
        $qry = "SELECT name FROM xt_product WHERE id_product='{$i}'";
        $name = mysql_fetch_array(mysql_query($qry));
        $name_index = Words2BaseForm($name[0]);
        $qry = "UPDATE xt_product SET name_index='{$name_index}' WHERE id_product='{$i}'";
        mysql_query($qry);
        $total++;
    }
    echo "<br>{$total} records processed<br>";
}