コード例 #1
0
<?php

require 'lib/common.php';
if (!admin()) {
    header("location: login.php");
}
require 'inc/header.php';
require 'inc/menu.php';
if (empty($_GET['cat'])) {
    $category = 0;
} else {
    $category = $_GET['cat'];
}
if (isset($_POST['insert_cat'])) {
    insert_category($_POST['category'], $category);
}
if (isset($_GET['deletecat'])) {
    delete_category($_GET['deletecat']);
}
?>

<div class='col-12'>


<h1>Categories</h1>

<?php 
$sql = "SELECT * FROM Categories WHERE parent_cat = ?";
$stm = $conn->prepare($sql);
$stm->execute(array($cat));
$category = $stm->fetchAll();
コード例 #2
0
ファイル: conv_cat.php プロジェクト: baowzh/fulianweb
    //die($catname);
    $sql = "INSERT INTO `fuliancms`.`v9_category` (`catid`, `siteid`, `module`, `type`, `modelid`, `parentid`, `arrparentid`, `child`, `arrchildid`, `catname`, `style`, `image`, `description`, `parentdir`, `catdir`, `url`, `items`, `hits`, `setting`, `listorder`, `ismenu`, `sethtml`, `letter`, `usable_type`) VALUES ({$id}, '1', 'content', '0', '1', '{$parentid}', '', '0', '', '{$catname}', '', '', '', '', '{$id}', '', '0', '0', '{$settings}', '0', '1', '0', '', '');";
    mysql_query($sql, $conn);
    mysql_close($conn);
}
include 'adodb/adodb.inc.php';
$db = ADONewConnection('ado_access');
$access = realpath('./data.mdb');
$myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' . 'DATA SOURCE=' . $access . ';' . "Jet OLEDB:Database Password=;";
$db->Connect($myDSN);
$recordSet = $db->Execute('select * from HN_newscla');
if (!$recordSet) {
    print $db->ErrorMsg();
} else {
    while (!$recordSet->EOF) {
        $rs = $recordSet->fields;
        $id = $rs[0];
        var_dump($id);
        $big = $recordSet->fields[1];
        $small = $recordSet->fields[2];
        $parentid = (int) $recordSet->fields[3];
        $big = iconv("GBK", "UTF-8", $big);
        $small = iconv("GBK", "UTF-8", $small);
        echo "inserting...";
        insert_category($id, $parentid, $big, $small);
        //echo $name , "<br>";
        $recordSet->MoveNext();
    }
}
$recordSet->Close();
$db->Close();
コード例 #3
0
<?php

// include function files for this application
require_once 'book_sc_fns.php';
session_start();
do_html_header('Adding a category');
if (check_admin_user()) {
    if (filled_out($HTTP_POST_VARS)) {
        $catname = $HTTP_POST_VARS['catname'];
        if (insert_category($catname)) {
            echo "Category '{$catname}' was added to the database.<br />";
        } else {
            echo "Category '{$catname}' could not be added to the database.<br />";
        }
    } else {
        echo 'You have not filled out the form.  Please try again.';
    }
    do_html_url('admin.php', 'Back to administration menu');
} else {
    echo 'You are not authorised to view this page.';
}
do_html_footer();
コード例 #4
0
ファイル: auto_install.php プロジェクト: exploit86/Devoncha
    }
}
/////////////// SHIPPING METHIDS END ///////////////
/////////////// DISCOUNT COUPON START ///////////////
$discount_coupons = array();
$discount_coupons = get_option('discount_coupons');
if (!$discount_coupons) {
    $discount_coupons_arr[] = array("couponcode" => 'FRIENDS', "dis_per" => 'per', "dis_amt" => '15');
    $discount_coupons_arr[] = array("couponcode" => 'SPECIAL', "dis_per" => 'amt', "dis_amt" => '100');
    update_option('discount_coupons', $discount_coupons_arr);
}
/////////////// DISCOUNT COUPON END ///////////////
/////////////// TERMS START ///////////////
require_once ABSPATH . 'wp-admin/includes/taxonomy.php';
$category_array = array('Blog', 'Feature', 'Electronics', 'Beauty &amp; Fragrance', 'Books', array('Digital Products', 'Icons', 'Wordpress Theme'), 'Kids', array('Men', 'Coats &amp; Jackets', 'Hats, Gloves &amp; Scarves', 'Shirts and Ties'), array('Shoe', 'Boots', 'Sandals'));
insert_category($category_array);
function insert_category($category_array)
{
    for ($i = 0; $i < count($category_array); $i++) {
        $parent_catid = 0;
        if (is_array($category_array[$i])) {
            $cat_name_arr = $category_array[$i];
            for ($j = 0; $j < count($cat_name_arr); $j++) {
                $catname = $cat_name_arr[$j];
                $last_catid = wp_create_category($catname, $parent_catid);
                if ($j == 0) {
                    $parent_catid = $last_catid;
                }
            }
        } else {
            $catname = $category_array[$i];
コード例 #5
0
<?php

if (!defined('WW_SESS')) {
    exit;
}
// page title - if undefined the site title is displayed by default
$page_title = 'Categories';
// process post actions
// insert category
if (isset($_POST['add_category']) && $_POST['add_category'] == 'add') {
    $insert_status = insert_category();
    if (is_int($insert_status)) {
        $reload = $_SERVER["PHP_SELF"] . '?page_name=categories&category_id=' . $insert_status;
        header('Location: ' . $reload);
    } else {
        $insert_error = $insert_status;
    }
}
// edit category
if (isset($_POST['edit_category']) && $_POST['edit_category'] == 'edit') {
    $category_id = (int) $_GET['category_id'];
    $update_status = update_category($category_id);
    if ($update_status === true) {
        header('Location: ' . $url);
    } else {
        $error = $update_status;
    }
}
// delete category
if (isset($_POST['confirm_delete_category']) && $_POST['confirm_delete_category'] == 'Yes') {
    $category_id = (int) $_GET['category_id'];
コード例 #6
0
function change_categories() {
	global $user, $current_user, $globals;
	$errors = 0;
	$ncat = 0;
	
	if( !(isset($_POST['new']) || isset($_POST['delete'])) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id ) return;

	if (isset($_POST['delete'])) {
		delete_category(array_keys($_POST['delete']));
	} elseif (isset($_POST['new_cat'])) {
		insert_category(trim($_POST['new_cat']), trim($_POST['new_parent']), trim($_POST['new_feed']), trim($_POST['new_tags']));
	} else {
		foreach (array_keys($_POST['new_cat-edit']) as $key) {
			$category->id[$ncat]=trim($key);
			$ncat++;
		}
		$ncat=0;
		foreach ($_POST['new_cat-edit'] as $catitem) {
			$category->name[$ncat]=trim($catitem);
			$ncat++;
		}
		$ncat=0;
		foreach ($_POST['new_parent-edit'] as $catparent) {
			$category->parent[$ncat]=intval($catparent);
			$ncat++;
		}
		$ncat=0;
		foreach ($_POST['new_feed-edit'] as $catfeed) {
			$category->feed[$ncat]=htmlspecialchars(trim($catfeed));
			$ncat++;
		}
		$ncat=0;
		foreach ($_POST['new_tags-edit'] as $cattags) {
			$category->tags[$ncat]=trim($cattags);
			$ncat++;
		}
		if ( !(empty($_POST['new_cat-edit']) || empty($_POST['new-cat'])) ) {
			$errors = 1;
			echo '<p class="form-error">'._('No ha introducido ninguna categoría nueva').'</p>';
		}
		if ( empty($_POST['new_tags-edit']) ) {
			$errors = 1;
			echo '<p class="form-error">'._('No ha introducido ninguna etiqueta').'</p>';
		}
		if (!$errors) {
			save_categories($category);
			echo '<p class="form-act">'._('Datos actualizados').'</p>';
		}
	}
}
コード例 #7
0
    echo $categoryName;
    ?>
</th>
            <th><?php 
    echo $categoryPercentage;
    ?>
</th>
            <th><?php 
    echo $snsID;
    ?>
</th>
          </tr>
          <?php 
    //カテゴリーの集計結果をDBに追加
    if ($db == true) {
        $insert_category = insert_category($categoryName, $categoryPercentage, $snsID);
    }
}
//エラーが発生しなければ表示
if (!isset($insert_category) && $db == true) {
    echo 'カテゴリーの集計結果をDBに追加しました。<br> . <br>';
} else {
    echo 'カテゴリーの集計結果<br> . <br>';
}
?>
    </table>
    <?php 
echo "<br>";
//カテゴリーの集計結果を取得
$select_category = select_all('category');
?>
コード例 #8
0
ファイル: dbo.php プロジェクト: kmklr72/lmms.io
function insert_filetype($extension, $category)
{
    $category_id = insert_category($category);
    $filetype_id = get_filetype_id($extension, $category);
    // Extension/category pair doesn't exist yet, insert our row
    if ($filetype_id < 0) {
        $dbh =& get_db();
        $stmt = $dbh->prepare('INSERT INTO filetypes (extension, category) VALUES(LOWER(:extension), :category_id)');
        $fixed_extension = fix_extension($extension);
        $stmt->bindParam(':extension', $fixed_extension);
        $stmt->bindParam(':category_id', $category_id);
        // Inserted successfully, find our filetype id
        if ($stmt->execute()) {
            $filetype_id = get_filetype_id($fixed_extension, $category);
        }
        $stmt = null;
        $dbh = null;
    }
    return $filetype_id;
}
コード例 #9
0
<?php

$php_root_path = "..";
$privilege_root_path = "/admin";
require_once "includes/include_all_fns.inc";
session_start();
$err_message = " Unable to process your request due to the following problems: <br>\n";
//Code added  to address security problem reported by Sebastian Held 14-Nov-2006
$header = "Setup Category";
$accepted_privilegeID_arr = array(3 => "");
$accepted_phaseID_arr = array(1 => "", 2 => "", 3 => "", 4 => "");
authentication($header, $accepted_privilegeID_arr, $accepted_phaseID_arr, $homepage, $php_root_path, $GLOBALS["DB_PREFIX"], &$err_message);
if (!session_is_registered_register_global_off("s_category_post")) {
    //Register the session
    session_register_register_global_off("s_category_post");
}
$s_category_post["numcat"] = $numcat;
if ($Submit == "Update Number") {
    //Updating the number of categories
    header("Location: setup_category.php");
} else {
    //Insert the category to the table
    $result = insert_category($arrCategoryName);
    do_html_header("Updating Information Successful");
    echo $result;
    do_html_footer();
}
コード例 #10
0
ファイル: insert.php プロジェクト: ikea-dless/web_app_html
try {
    $pdo = new PDO('mysql:host=localhost;dbname=web_app;charset=utf8;', 'root', '', array(PDO::ATTR_EMULATE_PREPARES => false));
} catch (PDOException $e) {
    die('データベースに接続できませんでした: ' . $e->getMessage());
}
$ary = array('観葉植物', '多肉植物', '肥料', '花工場原液');
$categories = $pdo->prepare("SELECT * FROM categories");
$categories->execute();
$categories = $categories->fetchAll();
var_dump($categories);
$stmt = $pdo->prepare("INSERT INTO categories (name, created_at, updated_at) VALUES (:name, :created_at, :updated_at)");
foreach ($ary as $name) {
    if (empty($categories)) {
        insert_category($stmt, $name);
    }
    foreach ($categories as $category) {
        if ($category["name"] === $name) {
            break 2;
        } else {
            insert_category($stmt, $name);
        }
    }
}
function insert_category($stmt, $name)
{
    $stmt->bindParam(':name', $name, PDO::PARAM_STR);
    $stmt->bindParam(':created_at', date("Y-m-d H:i:s"), PDO::PARAM_STR);
    $stmt->bindParam(':updated_at', date("Y-m-d H:i:s"), PDO::PARAM_STR);
    $stmt->execute();
}