PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи

Страниц (19): « 1 2 3 [4] 5 6 7 8 9 ... » В конец

> Найдено сообщений: 280
grafillo Отправлено: 01 Января, 2015 - 22:49:32 • Тема: Распарсить XML с атрибутами • Форум: Напишите за меня, пожалуйста

Ответов: 4
Просмотров: 48
Распарсите пожалуйста данный xml с атрибутами
CODE (htmlphp):
скопировать код в буфер обмена
  1.  
  2.  
  3. <xml>
  4. <bot login="BOT1" select_room="1" id_unreg_user="id1">SharaBot</bot>
  5. <bot login="BOT2" select_room="2" id_unreg_user="id2">WaraBot</bot>
  6. </xml>
  7.  

нужно получить всё и номер комнаты и айди и логин и сам бот
grafillo Отправлено: 01 Января, 2015 - 17:09:20 • Тема: Проблемы с XML • Форум: Вопросы новичков

Ответов: 4
Просмотров: 263
andrewkard пишет:
Поставьте в цикл foreach:
$i+=1;
echo $i;

и что это дст?
(Добавление)
всё работает только когда не добавлены атрибуты логин рум, без атрибутов парсится номрально с атрибутами не парсится почемуто(((
(Добавление)
может атрибуты нельзя передавать через пост?
grafillo Отправлено: 01 Января, 2015 - 13:41:12 • Тема: Проблемы с XML • Форум: Вопросы новичков

Ответов: 4
Просмотров: 263
kotyara1979 пишет:
А что приходит в $_POST['xml']? Как происходит отправка?
Что показывает var_dump?

норм всё передаётся идентичный xml, если просто раскоментить запрос
CODE (htmlphp):
скопировать код в буфер обмена
  1. mysql_query("INSERT INTO tb_room SET Login='$req',Time='$servertime',user_type='unregistered',Room='$select_room' ");

то всё норм заносится в Login норм вида xml
(Добавление)
кароч mysql_query в конструкции foreach работает только если вне её тоже запустить mysql_query, фигня какаято(((
grafillo Отправлено: 01 Января, 2015 - 11:27:39 • Тема: Проблемы с XML • Форум: Вопросы новичков

Ответов: 4
Просмотров: 263
Почемуто если передаю xml через post то ничего не работает а если такой же xml пишу вручную $req = '<xml><bot login="BOT2" select_room="гогого" id_unreg_user="">SharaBot</bot> - тогда всё прекрасно парсится и работает, в чём может быть проблема?

PHP:
скопировать код в буфер обмена
  1. function pars_xml () {
  2. $servertime = time();
  3. $req = $_POST['xml'];
  4.  
  5.  
  6. //mysql_query("INSERT INTO tb_room SET Login='$req',Time='$servertime',user_type='unregistered',Room='$select_room' ");
  7. //$req = '<xml><bot login="BOT2" select_room="гогого" id_unreg_user="">SharaBot</bot></xml>';
  8. $xml = new SimpleXmlIterator ($req);
  9.         foreach ($xml as $bot)
  10.                 {
  11.                          $select_room = $bot['select_room'];
  12.                          $login = $bot['login'];
  13.                        
  14.                         mysql_query("INSERT INTO tb_room SET Login='$bot',Time='$servertime',user_type='unregistered',Room='$select_room' ");
  15.                        
  16.                                
  17.                 }
  18.  
  19. }
grafillo Отправлено: 31 Декабря, 2014 - 16:33:13 • Тема: Ошибка апача • Форум: Apache и другие веб-серверы

Ответов: 1
Просмотров: 776
кароч заменил в файле /etc/apache2/conf.d/apache2-doc
AllowOverride off на AllowOverride all перезапустил и всё заработало, что это могло быть почему же упал сервер?


Alias /manual /usr/share/doc/apache2-doc/manua l/

<Directory "/usr/share/doc/apache2-doc/manual/">
Options Indexes FollowSymlinks
AllowOverride all - заменил
Order allow,deny
Allow from all
AddDefaultCharset off
</Directory>
grafillo Отправлено: 31 Декабря, 2014 - 13:43:30 • Тема: Ошибка апача • Форум: Apache и другие веб-серверы

Ответов: 1
Просмотров: 776
Почемуто слетел по утру сервер пишет такую ошибку

Alert!: Unable to connect to remote host.

lynx: Can't access startfile http://localhost/server-status
'www-browser -dump http://localhost:80/server-status' failed.
Maybe you need to install a package providing www-browser or you
need to adjust the APACHE_LYNX variable in /etc/apache2/envvars

что это означает и что делать?
мож меня хакнул кто?
grafillo Отправлено: 29 Декабря, 2014 - 21:12:18 • Тема: Помогите распарсить XML • Форум: Вопросы новичков

Ответов: 3
Просмотров: 222
PHP:
скопировать код в буфер обмена
  1. $xml = '<xml>
  2. <bot login="ttt" time="11111">VaraBot</bot>
  3. <bot login="ccc" time="11111">SharaBot</bot>
  4. </xml>';
  5.  
  6. $mydata = new SimpleXmlIterator($xml);
  7.  
  8. for ($mydata->rewind();$mydata->valid();$mydata->next()) {
  9. echo($mydata->current()->attributes());
  10. }


нашёл как распарсить, но теперь если появляется второй атрибут time то к нему не могу получить доступ
и ваще непонятно что это за функции и чё они делают rewind() valid() next()
знающие подскажите
grafillo Отправлено: 29 Декабря, 2014 - 18:13:31 • Тема: Помогите распарсить XML • Форум: Вопросы новичков

Ответов: 3
Просмотров: 222
Есть XML
CODE (htmlphp):
скопировать код в буфер обмена
  1. <xml>
  2. <bot login="ttt" >VaraBot</bot>
  3. <bot login="ccc">SharaBot</bot>
  4. </xml>

надо его распарсить и добавить в таблицу, кто может написать простой код доступа к login и к содержимому?
делаю через
PHP:
скопировать код в буфер обмена
  1. $xml = new SimpleXMLElement($req);
grafillo Отправлено: 23 Декабря, 2014 - 15:21:31 • Тема: Безопасность сервера • Форум: Администрирование *nix

Ответов: 2
Просмотров: 991
Посоветуйте что почитать про безопасность сервера ubuntu и скриптов php. Подскажите на что в первую очередь стоит обратить внимание для безопасности скриптов и взлома, что первым делом следует сделать, закрыть какие дырки прописать какие команды?
Полезные ссылки приветствуются также приветствуется описание последовательности действий на основании своего опыта.
grafillo Отправлено: 18 Декабря, 2014 - 12:57:14 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
нашёл файл etc/apache2/conf.d/аpache2 doc
CODE (htmlphp):
скопировать код в буфер обмена
  1.  
  2.  
  3. Alias /manual /usr/share/doc/apache2-doc/manual/
  4.  
  5. <Directory "/usr/share/doc/apache2-doc/manual/">
  6.     Options Indexes FollowSymlinks
  7.     AllowOverride All
  8.     Order allow,deny
  9.     Allow from all
  10.     AddDefaultCharset off
  11. </Directory>
  12.  
  13.  
  14.  

тут нашёл AllowOverride заменил его на all

ещё есть файл etc/apache2/apache2.conf но тут нету строчки AllowOverride
CODE (htmlphp):
скопировать код в буфер обмена
  1.  
  2. #
  3. # Based upon the NCSA server configuration files originally by Rob McCool.
  4. #
  5. # This is the main Apache server configuration file.  It contains the
  6. # configuration directives that give the server its instructions.
  7. # See http://httpd.apache.org/docs/2.2/ for detailed information about
  8. # the directives.
  9. #
  10. # Do NOT simply read the instructions in here without understanding
  11. # what they do.  They're here only as hints or reminders.  If you are unsure
  12. # consult the online docs. You have been warned.  
  13. #
  14. # The configuration directives are grouped into three basic sections:
  15. #  1. Directives that control the operation of the Apache server process as a
  16. #     whole (the 'global environment').
  17. #  2. Directives that define the parameters of the 'main' or 'default' server,
  18. #     which responds to requests that aren't handled by a virtual host.
  19. #     These directives also provide default values for the settings
  20. #     of all virtual hosts.
  21. #  3. Settings for virtual hosts, which allow Web requests to be sent to
  22. #     different IP addresses or hostnames and have them handled by the
  23. #     same Apache server process.
  24. #
  25. # Configuration and logfile names: If the filenames you specify for many
  26. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  27. # server will use that explicit path.  If the filenames do *not* begin
  28. # with "/", the value of ServerRoot is prepended -- so "foo.log"
  29. # with ServerRoot set to "/etc/apache2" will be interpreted by the
  30. # server as "/etc/apache2/foo.log".
  31. #
  32.  
  33. ### Section 1: Global Environment
  34. #
  35. # The directives in this section affect the overall operation of Apache,
  36. # such as the number of concurrent requests it can handle or where it
  37. # can find its configuration files.
  38. #
  39.  
  40. #
  41. # ServerRoot: The top of the directory tree under which the server's
  42. # configuration, error, and log files are kept.
  43. #
  44. # NOTE!  If you intend to place this on an NFS (or otherwise network)
  45. # mounted filesystem then please read the LockFile documentation (available
  46. # at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
  47. # you will save yourself a lot of trouble.
  48. #
  49. # Do NOT add a slash at the end of the directory path.
  50. #
  51. #ServerRoot "/etc/apache2"
  52.  
  53. #
  54. # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
  55. #
  56. LockFile ${APACHE_LOCK_DIR}/accept.lock
  57.  
  58. #
  59. # PidFile: The file in which the server should record its process
  60. # identification number when it starts.
  61. # This needs to be set in /etc/apache2/envvars
  62. #
  63. PidFile ${APACHE_PID_FILE}
  64.  
  65. #
  66. # Timeout: The number of seconds before receives and sends time out.
  67. #
  68. Timeout 300
  69.  
  70. #
  71. # KeepAlive: Whether or not to allow persistent connections (more than
  72. # one request per connection). Set to "Off" to deactivate.
  73. #
  74. KeepAlive On
  75.  
  76. #
  77. # MaxKeepAliveRequests: The maximum number of requests to allow
  78. # during a persistent connection. Set to 0 to allow an unlimited amount.
  79. # We recommend you leave this number high, for maximum performance.
  80. #
  81. MaxKeepAliveRequests 100
  82.  
  83. #
  84. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  85. # same client on the same connection.
  86. #
  87. KeepAliveTimeout 5
  88.  
  89. ##
  90. ## Server-Pool Size Regulation (MPM specific)
  91. ##
  92.  
  93. # prefork MPM
  94. # StartServers: number of server processes to start
  95. # MinSpareServers: minimum number of server processes which are kept spare
  96. # MaxSpareServers: maximum number of server processes which are kept spare
  97. # MaxClients: maximum number of server processes allowed to start
  98. # MaxRequestsPerChild: maximum number of requests a server process serves
  99. <IfModule mpm_prefork_module>
  100. StartServers       1
  101. MinSpareServers    1
  102. MaxSpareServers    5
  103. MaxClients        10
  104.     MaxRequestsPerChild   0
  105. </IfModule>
  106.  
  107. # worker MPM
  108. # StartServers: initial number of server processes to start
  109. # MinSpareThreads: minimum number of worker threads which are kept spare
  110. # MaxSpareThreads: maximum number of worker threads which are kept spare
  111. # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
  112. #              graceful restart. ThreadLimit can only be changed by stopping
  113. #              and starting Apache.
  114. # ThreadsPerChild: constant number of worker threads in each server process
  115. # MaxClients: maximum number of simultaneous client connections
  116. # MaxRequestsPerChild: maximum number of requests a server process serves
  117. <IfModule mpm_worker_module>
  118. StartServers       1
  119. MinSpareThreads    1
  120. MaxSpareThreads    4
  121.     ThreadLimit          64
  122.     ThreadsPerChild      25
  123. MaxClients        10
  124.     MaxRequestsPerChild   0
  125. </IfModule>
  126.  
  127. # event MPM
  128. # StartServers: initial number of server processes to start
  129. # MinSpareThreads: minimum number of worker threads which are kept spare
  130. # MaxSpareThreads: maximum number of worker threads which are kept spare
  131. # ThreadsPerChild: constant number of worker threads in each server process
  132. # MaxClients: maximum number of simultaneous client connections
  133. # MaxRequestsPerChild: maximum number of requests a server process serves
  134. <IfModule mpm_event_module>
  135. StartServers       1
  136. MinSpareThreads    1
  137. MaxSpareThreads    4
  138.     ThreadLimit          64
  139.     ThreadsPerChild      25
  140. MaxClients        10
  141.     MaxRequestsPerChild   0
  142. </IfModule>
  143.  
  144. # These need to be set in /etc/apache2/envvars
  145. User ${APACHE_RUN_USER}
  146. Group ${APACHE_RUN_GROUP}
  147.  
  148. #
  149. # AccessFileName: The name of the file to look for in each directory
  150. # for additional configuration directives.  See also the AllowOverride
  151. # directive.
  152. #
  153.  
  154. AccessFileName .htaccess
  155.  
  156. #
  157. # The following lines prevent .htaccess and .htpasswd files from being
  158. # viewed by Web clients.
  159. #
  160. <Files ~ "^\.ht">
  161.     Order allow,deny
  162.     Deny from all
  163.     Satisfy all
  164. </Files>
  165.  
  166. #
  167. # DefaultType is the default MIME type the server will use for a document
  168. # if it cannot otherwise determine one, such as from filename extensions.
  169. # If your server contains mostly text or HTML documents, "text/plain" is
  170. # a good value.  If most of your content is binary, such as applications
  171. # or images, you may want to use "application/octet-stream" instead to
  172. # keep browsers from trying to display binary files as though they are
  173. # text.
  174. #
  175. # It is also possible to omit any default MIME type and let the
  176. # client's browser guess an appropriate action instead. Typically the
  177. # browser will decide based on the file's extension then. In cases
  178. # where no good assumption can be made, letting the default MIME type
  179. # unset is suggested  instead of forcing the browser to accept
  180. # incorrect  metadata.
  181. #
  182. DefaultType None
  183.  
  184.  
  185. #
  186. # HostnameLookups: Log the names of clients or just their IP addresses
  187. # e.g., www.apache.org (on) or 204.62.129.132 (off).
  188. # The default is off because it'd be overall better for the net if people
  189. # had to knowingly turn this feature on, since enabling it means that
  190. # each client request will result in AT LEAST one lookup request to the
  191. # nameserver.
  192. #
  193. HostnameLookups Off
  194.  
  195. # ErrorLog: The location of the error log file.
  196. # If you do not specify an ErrorLog directive within a <VirtualHost>
  197. # container, error messages relating to that virtual host will be
  198. # logged here.  If you *do* define an error logfile for a <VirtualHost>
  199. # container, that host's errors will be logged there and not here.
  200. #
  201. ErrorLog ${APACHE_LOG_DIR}/error.log
  202.  
  203. #
  204. # LogLevel: Control the number of messages logged to the error_log.
  205. # Possible values include: debug, info, notice, warn, error, crit,
  206. # alert, emerg.
  207. #
  208. LogLevel warn
  209.  
  210. # Include module configuration:
  211. Include mods-enabled/*.load
  212. Include mods-enabled/*.conf
  213.  
  214. # Include all the user configurations:
  215. Include httpd.conf
  216.  
  217. # Include ports listing
  218. Include ports.conf
  219.  
  220. #
  221. # The following directives define some format nicknames for use with
  222. # a CustomLog directive (see below).
  223. # If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
  224. #
  225. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
  226. LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
  227. LogFormat "%h %l %u %t \"%r\" %>s %O" common
  228. LogFormat "%{Referer}i -> %U" referer
  229. LogFormat "%{User-agent}i" agent
  230.  
  231. # Include of directories ignores editors' and dpkg's backup files,
  232. # see README.Debian for details.
  233.  
  234. # Include generic snippets of statements
  235. Include conf.d/
  236.  
  237. # Include the virtual host configurations:
  238. Include sites-enabled/
  239.  
  240.  
grafillo Отправлено: 18 Декабря, 2014 - 12:06:14 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
у меня нет конфигов виртуал хоста, у меня сайт лежит в корневой папке www, я так понимаю надо настроить htaccess редирект с www на без www
(Добавление)
я добавил в папку www файл htaccess вот такой
CODE (htmlphp):
скопировать код в буфер обмена
  1.  
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^www.mysite.ru$ [NC]
  4. RewriteRule ^(.*)$ http://mysite.ru/$1 [R=301,L]
  5.  

но ничего не работает
grafillo Отправлено: 18 Декабря, 2014 - 01:24:03 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
кароч я понял, фишка в том что я прописал имена файлов без ввв, если прописываю пути к файлам с ввв тогда не рабоатет без ввв и наоборот х)
как это наладить то?
grafillo Отправлено: 18 Декабря, 2014 - 01:11:25 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
Panoptik пишет:
показывайте конфиг виртуал хоста. а то угадывать тут не умеют

а где он лежит?
grafillo Отправлено: 18 Декабря, 2014 - 01:01:47 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
RickMan пишет:
Апач настроен правильно? Указан и ServerName (с www) и ServerAlias (без www)?

а как правильно настроить?
ну с ввв грузится только почемуто пхп скрипты не работают((
grafillo Отправлено: 17 Декабря, 2014 - 23:44:42 • Тема: Почему не работает php на домене с www • Форум: Apache и другие веб-серверы

Ответов: 10
Просмотров: 1273
Есть домен если я пишу имя домена без www тогда всё работает если пишу имя домена с www тогда всё грузится но php не работает, в чём может быть проблема?

Страниц (19): « 1 2 3 [4] 5 6 7 8 9 ... » В конец
Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB