本文整理汇总了PHP中osc_db_connect函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_db_connect函数的具体用法?PHP osc_db_connect怎么用?PHP osc_db_connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_db_connect函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Copyright
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2014 osCommerce
Released under the GNU General Public License
*/
require '../includes/database_tables.php';
osc_db_connect(trim($_POST['DB_SERVER']), trim($_POST['DB_SERVER_USERNAME']), trim($_POST['DB_SERVER_PASSWORD']));
osc_db_select_db(trim($_POST['DB_DATABASE']));
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_NAME']) . '" where configuration_key = "STORE_NAME"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_NAME']) . '" where configuration_key = "STORE_OWNER"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "STORE_OWNER_EMAIL_ADDRESS"');
if (!empty($_POST['CFG_STORE_OWNER_NAME']) && !empty($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS'])) {
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "\\"' . trim($_POST['CFG_STORE_OWNER_NAME']) . '\\" <' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '>" where configuration_key = "EMAIL_FROM"');
} else {
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($_POST['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "EMAIL_FROM"');
}
if (!empty($_POST['CFG_ADMINISTRATOR_USERNAME'])) {
$check_query = osc_db_query('select user_name from ' . TABLE_ADMINISTRATORS . ' where user_name = "' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '"');
if (osc_db_num_rows($check_query)) {
osc_db_query('update ' . TABLE_ADMINISTRATORS . ' set user_password = "' . osc_encrypt_password(trim($_POST['CFG_ADMINISTRATOR_PASSWORD'])) . '" where user_name = "' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '"');
} else {
osc_db_query('insert into ' . TABLE_ADMINISTRATORS . ' (user_name, user_password) values ("' . trim($_POST['CFG_ADMINISTRATOR_USERNAME']) . '", "' . osc_encrypt_password(trim($_POST['CFG_ADMINISTRATOR_PASSWORD'])) . '")');
}
}
示例2: Copyright
<?php
/*
$Id: $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2007 osCommerce
Released under the GNU General Public License
*/
require '../includes/database_tables.php';
osc_db_connect($HTTP_POST_VARS['DB_SERVER'], $HTTP_POST_VARS['DB_SERVER_USERNAME'], $HTTP_POST_VARS['DB_SERVER_PASSWORD']);
osc_db_select_db($HTTP_POST_VARS['DB_DATABASE']);
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . $HTTP_POST_VARS['CFG_STORE_NAME'] . '" where configuration_key = "STORE_NAME"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . $HTTP_POST_VARS['CFG_STORE_OWNER_NAME'] . '" where configuration_key = "STORE_OWNER"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . $HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS'] . '" where configuration_key = "STORE_OWNER_EMAIL_ADDRESS"');
if (!empty($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) && !empty($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS'])) {
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "\\"' . $HTTP_POST_VARS['CFG_STORE_OWNER_NAME'] . '\\" <' . $HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS'] . '>" where configuration_key = "EMAIL_FROM"');
}
$check_query = osc_db_query('select user_name from ' . TABLE_ADMINISTRATORS . ' where user_name = "' . $HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME'] . '"');
if (osc_db_num_rows($check_query)) {
osc_db_query('update ' . TABLE_ADMINISTRATORS . ' set user_password = "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '" where user_name = "' . $HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME'] . '"');
} else {
osc_db_query('insert into ' . TABLE_ADMINISTRATORS . ' (user_name, user_password) values ("' . $HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME'] . '", "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '")');
}
?>
<div class="mainBlock">
<div class="stepsBox">
示例3: Copyright
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
?>
<p class="pageTitle">Upgrade</p>
<?php
$db = array();
$db['DB_SERVER'] = trim(stripslashes($_POST['DB_SERVER']));
$db['DB_SERVER_USERNAME'] = trim(stripslashes($_POST['DB_SERVER_USERNAME']));
$db['DB_SERVER_PASSWORD'] = trim(stripslashes($_POST['DB_SERVER_PASSWORD']));
$db['DB_DATABASE'] = trim(stripslashes($_POST['DB_DATABASE']));
osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
osc_db_select_db($db['DB_DATABASE']);
function osc_get_languages()
{
$languages_query = osc_db_query("select languages_id, name, code, image, directory from languages order by sort_order");
while ($languages = osc_db_fetch_array($languages_query)) {
$languages_array[] = array('id' => $languages['languages_id'], 'name' => $languages['name'], 'code' => $languages['code'], 'image' => $languages['image'], 'directory' => $languages['directory']);
}
return $languages_array;
}
function osc_currency_format($number, $calculate_currency_value = true, $currency_code = DEFAULT_CURRENCY, $value = '')
{
$currency_query = osc_db_query("select symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies where code = '" . $currency_code . "'");
$currency = osc_db_fetch_array($currency_query);
if ($calculate_currency_value == true) {
if (strlen($currency_code) == 3) {
示例4: session_start
<?php
session_start();
include "db.php";
if (isset($_POST['submit']) && $_POST['submit'] == 'Submit' && trim($_POST['site_title']) != '' && trim($_POST['site_admin_mail']) != '' && trim($_POST['admin_password']) != '') {
osc_db_connect($_SESSION['mysql_host'], $_SESSION['mysql_uname'], $_SESSION['mysql_password']);
osc_db_select_db($_SESSION['mysql_db']);
osc_db_query('update settings set string_value = "' . trim($_POST['site_title']) . '",created = "' . time() . '" where code = "SITE_TITLE"');
osc_db_query('update settings set string_value = "' . trim($_POST['site_admin_mail']) . '",created = "' . time() . '" where code = "SITE_ADMIN_MAIL"');
osc_db_query('update settings set string_value = "' . trim($_SESSION['baseurl']) . '",created = "' . time() . '" where code = "BASE_URL"');
//echo 'select admin_name from admins where admin_name = "' . trim($HTTP_POST_VARS['admin_name']) . '"';exit;
$check_query = osc_db_query('select admin_name from admins where admin_name = "' . trim($_POST['admin_name']) . '"');
if (osc_db_num_rows($check_query)) {
osc_db_query('update admins set password = "' . trim(md5($_POST['admin_password'])) . '" where admin_name = "' . trim($_POST['admin_name']) . '"');
} else {
osc_db_query('insert into admins set admin_name = "' . trim($_POST['admin_name']) . '", password = "' . trim(md5($_POST['admin_password'])) . '"');
}
header('Location: complete.php');
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'Submit') {
$site_title = trim($_POST['site_title']);
$site_admin_mail = trim($_POST['site_admin_mail']);
$admin_name = trim($_POST['admin_name']);
$admin_password = trim(md5($_POST['admin_password']));
$error = 'All the fields are required';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
示例5: Copyright
<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2008 osCommerce
Released under the GNU General Public License
*/
require '../includes/database_tables.php';
osc_db_connect(trim($HTTP_POST_VARS['DB_SERVER']), trim($HTTP_POST_VARS['DB_SERVER_USERNAME']), trim($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
osc_db_select_db(trim($HTTP_POST_VARS['DB_DATABASE']));
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_NAME']) . '" where configuration_key = "STORE_NAME"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) . '" where configuration_key = "STORE_OWNER"');
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "STORE_OWNER_EMAIL_ADDRESS"');
if (!empty($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) && !empty($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS'])) {
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "\\"' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_NAME']) . '\\" <' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '>" where configuration_key = "EMAIL_FROM"');
} else {
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "EMAIL_FROM"');
}
$check_query = osc_db_query('select user_name from ' . TABLE_ADMINISTRATORS . ' where user_name = "' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '"');
if (osc_db_num_rows($check_query)) {
osc_db_query('update ' . TABLE_ADMINISTRATORS . ' set user_password = "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '" where user_name = "' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '"');
} else {
osc_db_query('insert into ' . TABLE_ADMINISTRATORS . ' (user_name, user_password) values ("' . trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_USERNAME']) . '", "' . osc_encrypt_string(trim($HTTP_POST_VARS['CFG_ADMINISTRATOR_PASSWORD'])) . '")');
}
osc_db_query('update ' . TABLE_CONFIGURATION . ' set configuration_value = "' . trim($HTTP_POST_VARS['CFG_STORE_OWNER_EMAIL_ADDRESS']) . '" where configuration_key = "MODULE_PAYMENT_PAYPAL_EXPRESS_SELLER_ACCOUNT"');
?>
示例6: session_start
session_start();
include "db.php";
$baseURL = 'http://' . $_SERVER['SERVER_NAME'] . str_replace('\\', '/', $_SERVER['PHP_SELF']);
$length = strlen($baseURL) - strlen('install/install.php');
$length2 = strlen($_SERVER['PHP_SELF']) - strlen('install/install.php');
$folder = substr($_SERVER['PHP_SELF'], 0, $length2);
//$folder = str_replace("/"," ",$folder);
$baseURL = substr($baseURL, 0, $length);
$mysqlHost = '';
$mysqlUname = '';
$mysqlPass = '';
$mysqlDB = '';
if (isset($_POST['submit']) && $_POST['submit'] == 'Submit' && trim($_POST['base_url']) != '' && trim($_POST['mysql_host']) != '' && trim($_POST['mysql_uname']) != '' && trim($_POST['mysql_db']) != '') {
$error = '';
$link = @osc_db_connect(trim($_POST['mysql_host']), trim($_POST['mysql_uname']), trim($_POST['mysql_password']));
if (!$link) {
$error = 'Could not connect to the host specified. Error: ' . mysql_error();
} else {
//Connected successfully
$db_selected = @osc_db_select_db(trim($_POST['mysql_db']));
if (!$db_selected) {
$error = $error . '<BR>Can\'t use the database specified. Error: ' . mysql_error();
}
//mysql_close($link);
}
$baseURL = trim($_POST['base_url']);
$mysqlHost = trim($_POST['mysql_host']);
$mysqlUname = trim($_POST['mysql_uname']);
$mysqlPass = trim($_POST['mysql_password']);
$mysqlDB = trim($_POST['mysql_db']);
示例7: session_start
<?php
session_start();
error_reporting(0);
require_once "../app/config/config.php";
include "db.php";
if ($config['hostname'] != '' && $config['db_username'] != '' && $config['db'] != '') {
$link = @osc_db_connect(trim($config['hostname']), trim($config['db_username']), trim($config['db_password']));
if (!$link) {
$error = 'Could not connect to the host specified. Error: ' . mysql_error();
} else {
//Connected successfully
$db_selected = @osc_db_select_db(trim($config['db']));
if (!$db_selected) {
$error = $error . '<BR>Can\'t use the database specified. Error: ' . mysql_error();
}
//mysql_close($link);
}
//echo $error;exit;
$sql = " SHOW TABLES FROM " . trim($config['db']);
$result = osc_db_query($sql);
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
$numtable = osc_db_num_rows($result);
mysql_free_result($result);
if ($numtable > 0) {
header("Location: ../");
}
示例8: mysql_fetch_array
$result = mysql_fetch_array($db_query);
return $result;
}
function osc_db_num_rows($db_query)
{
return mysql_num_rows($db_query);
}
// Sets timeout for the current script.
// Cant be used in safe mode.
function osc_set_time_limit($limit)
{
if (!get_cfg_var('safe_mode')) {
set_time_limit($limit);
}
}
osc_db_connect() or die('Unable to connect to database server!');
?>
<p><span class="pageHeading">osCommerce</span><br><font color="#9a9a9a">Open Source E-Commerce Solutions</font></p>
<p class="pageTitle">Upgrade</p>
<p><b>Step 1: Database Upgrade</b></p>
<?php
osc_set_time_limit(0);
?>
<p><span id="configuration"><span id="configurationMarker">-</span> Configuration</span><br>
<span id="whosOnline"><span id="whosOnlineMarker">-</span> Who's Online</span></p>
<p>Status: <span id="statusText">Preparing</span></p>