Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

Сайт не конектится к внешней MySQL!

35K
19 февраля 2008 года
Topp
9 / / 19.02.2008
Поставил я себе на сервер MySQL 5.0 (держу сервер Lineage ][), на хостинг установил сайт, но этот сайт не может коннектиться к моей MySQL на сервере =((((((((((! В чем проблема?
Когда я держал этот сайт на Apache все было зашибись, но кода перенес =((.... Все настройки в конфигах правельные.
P.S. Умоляю помогите, где я только не искал, ничего не нашел :( :( ! Хелп ПЛИЗ!
2
20 февраля 2008 года
squirL
5.6K / / 13.08.2003
netstat -an с машины с mysql, ipconfig/ifconfig с нее же. открывок скрипта, где происходит коннект к базе - туда же. или мы догадываться должны?
35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
NetStat -an:
Цитата:
Microsoft Windows [Версия 5.2.3790]
(С) Корпорация Майкрософт, 1985-2003.

C:\Documents and Settings\Администратор>netstat -an

Активные подключения

Имя Локальный адрес Внешний адрес Состояние
TCP 127.0.0.1:1068 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1069 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1070 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1071 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1072 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1073 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1074 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1075 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1076 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1077 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1536 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1537 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1538 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1539 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1540 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1541 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1542 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1543 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1544 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:1545 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2703 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2704 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2705 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2706 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2708 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2709 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2710 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2711 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2712 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2720 127.0.0.1:2721 ESTABLISHED
TCP 127.0.0.1:2721 127.0.0.1:2720 ESTABLISHED
TCP 127.0.0.1:2741 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2742 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2743 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2744 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2745 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2807 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2808 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2809 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2810 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2811 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2982 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2983 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2984 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2985 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:2986 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3278 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3279 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3280 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3281 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3282 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1068 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1069 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1070 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1071 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1072 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1073 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1074 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1075 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1076 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1077 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1536 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1537 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1538 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1539 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1540 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1541 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1542 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1543 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1544 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:1545 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2703 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2704 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2705 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2706 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2708 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2709 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2710 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2711 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2712 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2741 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2742 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2743 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2744 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2745 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2807 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2808 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2809 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2810 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2811 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2982 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2983 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2984 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2985 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:2986 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3278 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3279 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3280 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3281 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3282 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:3342 TIME_WAIT
TCP 127.0.0.1:3306 127.0.0.1:3346 TIME_WAIT
TCP 127.0.0.1:3306 127.0.0.1:3347 TIME_WAIT
TCP 127.0.0.1:3306 127.0.0.1:4324 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4325 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4326 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4327 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4328 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4662 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4663 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4664 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4665 ESTABLISHED
TCP 127.0.0.1:3306 127.0.0.1:4666 ESTABLISHED
TCP 127.0.0.1:3342 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3344 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3346 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3347 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3349 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3351 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3352 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3354 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3355 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3356 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3358 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:3359 127.0.0.1:3306 TIME_WAIT
TCP 127.0.0.1:4324 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4325 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4326 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4327 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4328 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4662 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4663 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4664 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4665 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:4666 127.0.0.1:3306 ESTABLISHED
TCP 127.0.0.1:43958 0.0.0.0:0 LISTENING
UDP 0.0.0.0:445 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:1158 *:*
UDP 0.0.0.0:1587 *:*
UDP 0.0.0.0:4500 *:*
UDP 89.108.73.72:123 *:*
UDP 89.108.73.72:137 *:*
UDP 89.108.73.72:138 *:*
UDP 127.0.0.1:123 *:*
UDP 127.0.0.1:3367 *:*
UDP 127.0.0.1:3373 *:*

C:\Documents and Settings\Администратор>

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
ifconfig
Цитата:

Настройка протокола IP для Windows

Имя компьютера . . . . . . . . . : agava-xmap1f96d
Основной DNS-суффикс . . . . . . :
Тип узла. . . . . . . . . . . . . : неизвестный
IP-маршрутизация включена . . . . : нет
WINS-прокси включен . . . . . . . : нет

Подключение по локальной сети - Ethernet адаптер:

DNS-суффикс этого подключения . . :
Описание . . . . . . . . . . . . : Realtek RTL8169/8110 Family Gigabit Ether
net NIC
Физический адрес. . . . . . . . . : 00-1A-4D-38-66-A8
DHCP включен. . . . . . . . . . . : нет
IP-адрес . . . . . . . . . . . . : 89.108.73.72
Маска подсети . . . . . . . . . . : 255.255.248.0
Основной шлюз . . . . . . . . . . : 89.108.72.1
DNS-серверы . . . . . . . . . . . : 89.108.90.129
89.108.64.4

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
ipconfig
Цитата:

C:\Documents and Settings\Администратор>ipconfig

Настройка протокола IP для Windows


Подключение по локальной сети - Ethernet адаптер:

DNS-суффикс этого подключения . . :
IP-адрес . . . . . . . . . . . . : 89.108.73.72
Маска подсети . . . . . . . . . . : 255.255.248.0
Основной шлюз . . . . . . . . . . : 89.108.72.1

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
my.ini
Цитата:
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO


[client]
#password = [your_password]
port = 3306
socket = /tmp/mysql.sock

[mysqld]

# generic configuration options
port = 3306
socket = /tmp/mysql.sock

back_log = 50


max_connections = 100

max_connect_errors = 10


table_cache = 2048

max_allowed_packet = 16M

binlog_cache_size = 1M


max_heap_table_size = 64M

sort_buffer_size = 8M

join_buffer_size = 8M

thread_cache_size = 8

thread_concurrency = 8


query_cache_size = 64M


query_cache_limit = 2M

ft_min_word_len = 4

default_table_type = MYISAM

thread_stack = 192K

# Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size = 64M

# Enable binary logging. This is required for acting as a MASTER in a
# replication configuration. You also need the binary log if you need
# the ability to do point in time recovery from your latest backup.
log-bin=mysql-bin


log_slow_queries


long_query_time = 2


log_long_format


# *** Replication related settings


# Unique server identification number between 1 and 2^32-1. This value
# is required for both master and slave hosts. It defaults to 1 if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# changes in this file to the variable values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>

# Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
# use this to ensure that no applications will accidently modify data on
# the slave instead of the master
#read_only


#*** MyISAM Specific options


# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size = 32M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M

# When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
# Allocated per thread, when needed.
read_rnd_buffer_size = 16M

# MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to 0 will disable this optimisation. Do
# not set it larger than "key_buffer_size" for optimal performance.
# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 64M

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size = 128M

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size = 10G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size = 10G

# If a table has more than one index, MyISAM can use more than one
# thread to repair them by sorting in parallel. This makes sense if you
# have multiple CPUs and plenty of memory.
myisam_repair_threads = 1

# Automatically check and repair not properly closed MyISAM tables.
myisam_recover


# *** BDB Specific options ***

# Use this option if you run a MySQL server with BDB support enabled but
# you do not plan to use it. This will save memory and may speed up some
# things.
skip-bdb


# *** INNODB Specific options ***

# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 2G

# InnoDB stores data in one or more data files forming the tablespace.
# If you have a single logical drive for your data, a single
# autoextending file would be good enough. In other cases, a single file
# per device is often a good choice. You can configure InnoDB to use raw
# disk partitions as well - please refer to the manual for more info
# about this.
innodb_data_file_path = ibdata1:10M:autoextend

# Set this option if you would like the InnoDB tablespace files to be
# stored in another location. By default this is the MySQL datadir.
#innodb_data_home_dir = <directory>

# Number of IO threads to use for async IO operations. This value is
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = 4

# If you run into InnoDB tablespace corruption, setting this to a nonzero
# value will likely help you to dump your tables. Start from value 1 and
# increase it until you're able to dump the table successfully.
#innodb_force_recovery=1

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 8M

innodb_log_file_size = 256M


innodb_log_files_in_group = 3



innodb_max_dirty_pages_pct = 90



innodb_lock_wait_timeout = 120


[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick

max_allowed_packet = 16M

[mysql]
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
#safe-updates

[isamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[myisamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit = 8192



P.S. Закоментированные строчки стер (часть), т.к. не помещалось!

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
В данный момент вернул сайт на сервер с Апачи! Пашет нормально, но 1 скрипт который делает запрос, иногда не грузится... Вот он:
Цитата:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="center" class=line_up><table border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td valign="top"><div class=title_stat>
<div align="center"><strong>Получение CoL за глосование!
</strong></div>
</div></td>
</tr>
</table>
</td>
</tr>
</table><br />
<?php
$FAs_for_vote = 1; // Это количество FA за 1 голос
if (isset($_POST['nick']))
{
$total = 0;
$your_ip = $_SERVER['REMOTE_ADDR'];
echo '<b>Ник вашего чара: </b>'.$_POST['nick'].'<br />';
echo '<b>Ваш ip: </b>'.$your_ip.'<br />';
$error = '';
$voters = array();
include 'config/config.php';
$link = mysql_connect($L2JBS_config["mysql_host"], $L2JBS_config["mysql_login"], $L2JBS_config["mysql_password"]) or die("Could not connect : " . mysql_error());
mysql_select_db($L2JBS_config["mysql_db"]) or die("Could not connect : " . mysql_error());
mysql_query ("set NAMES cp1251");
$result = mysql_query("SELECT `obj_Id` FROM `characters` WHERE `char_name` = '".mysql_escape_string($_POST['nick'])."'");
$row = mysql_fetch_assoc($result);
if ($row == array())//есть ли такой чар вообще
$error .= 'Нет чара с таким именем!<br />';
else
{
$char_id = $row['obj_Id'];
$html = @file_get_contents('http://l2top.ru/?servID=3499&act=info');
if (!$html || !preg_match_all('/<td><a href=\'[^\']+\'>([^<]+)<\/a><\/td>\s+<td>([^<]+)<\/td>/', $html, $matches))
$error .= 'Не удалось получить информацию с l2top.ru!<br/>';
else
{
foreach ($matches[1] as $id => $ip)
{
if ($ip == $your_ip)
$voters[] = $matches[2][$id];
}
if ($voters != array())
{
foreach ($voters as $time)
{
$result = mysql_query("SELECT * FROM `l2top` WHERE `ip` = '".mysql_escape_string($your_ip)."' AND `time` = '".mysql_escape_string($time)."'");
$row = mysql_fetch_assoc($result);
if ($row == array())
{//добавляем бонусы
$result = mysql_query("SELECT * FROM `items` WHERE `owner_id` = ".mysql_escape_string($char_id)." AND `item_id` = 4037");
$row = mysql_fetch_assoc($result);
if ($row == array())
{
$result = mysql_query("SELECT MAX(`object_id`)+1 AS `id` FROM `items`");
$row = mysql_fetch_assoc($result);
$ins_id = $row['id'];
mysql_query("INSERT `items` (`owner_id`, `object_id`, `item_id`, `count`, `enchant_level`, `loc`, `loc_data`, `price_sell`, `price_buy`, `time_of_use`, `custom_type1`, `custom_type2`, `mana_left`, 'attrs', `donationId`)
VALUES(".mysql_escape_string($char_id).", ".$ins_id.", 4037, ".$FAs_for_vote.", 0, 'INVENTORY', 0, 0, 0, NULL, 0, 0, -1, 0)");
}
else
mysql_query("UPDATE `items` SET `count` = `count` + ".$FAs_for_vote." WHERE `owner_id` = ".mysql_escape_string($char_id)." AND `item_id` = 4037");
mysql_query("INSERT INTO `l2top` (`nick`, `ip`, `time`) VALUES ('".mysql_escape_string($_POST['nick'])."', '".mysql_escape_string($your_ip)."', '".mysql_escape_string($time)."')");
$total += $FAs_for_vote;
$error .= 'Голос за '. $time.' засчитан!<br/>';
}
else
$error .= 'Голос за '. $time.' уже был засчитан ранее!<br/>';
}
}
else
$error .= 'Вы НЕ голосовали!<br>';
}
}
echo $error.'<b>'.$total.'</b> CoL добавлено вашему чару!<br/><a href="l2topcol.php">Назад</a>';
}
else
{
?>
<form method="POST" action="l2topcol.php">
</p>
<div align="center">Введите ник вашего чара: <br />
<input type="text" name="nick" maxlength="25">
<br />
<br />
<input type="submit" value="Получить монеты">
</p>
</div>
</form>
<?php
}
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
Вот скрипт подключения к БД:
Цитата:
<?php
$link = @mysql_connect($L2JBS_config['mysql_host'].":".$L2JBS_config['mysql_port'], $L2JBS_config['mysql_login'], $L2JBS_config['mysql_password']) or die ('Невозможно установить соеденение с базой ! Проверьте настройки конфига !<br>Impossible create connect with the base! Check given required for connect with base MySQL!<br><br>Возможно сервер сейчас на профилактике, попробуйте зайти позже.<br>Possible server on preventive maintenance presently, try to call at later.');
@mysql_select_db($L2JBS_config['mysql_db'], $link) or die ('Найти базу с таким именем не удалось!');

?>

35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
Уважаемые модераторы, просьба не ругать, за то, что я написал все в разных сообщениях! Я сделал это для удобства и потому, что не помещалось все в 1!
2
20 февраля 2008 года
squirL
5.6K / / 13.08.2003
сайт и mysql находятся на разных машинах?
35K
20 февраля 2008 года
Topp
9 / / 19.02.2008
Если на разных, то не конектится вооооообще! А если на одной бывают сбои...
2
20 февраля 2008 года
squirL
5.6K / / 13.08.2003
Цитата: Topp
Если на разных, то не конектится вооооообще! .


ну да... это удивительно, если учесть, что у тебя MySQL слушает только localhost

9.5K
15 марта 2008 года
snubr
70 / / 30.10.2006
+1. А еще у тебя реальный IP или нет?!
А вот скрипт подкл. БД Он написан 99,5% верно.

 
Код:
<?php
$dblocation = 'ya.ru';
$dbname = '1f';
$dbuser = '1k';
$dbpasswd = '*********';
$mssql = @mssql_connect($dblocation, $dbuser, $dbpasswd) or die("Ошибка установки соединения с базой данных");
    @mssql_select_db('[1f]') or die("Ошибка подключение к базе данных {$dbname}");
?>
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог