|
php и не большой скрипт
|
|
| neonweb | Дата: 23 Мая 2010, 10:35 | Сообщение # 1 |  ● ● ● ● ● 352 сообщения Статус: Offline | Видел где-то на форуме. что можно к странице каким-то образом подключить php как можно запустить небольшой скриптик? | | |
|
| kanat07 | Дата: 23 Мая 2010, 10:58 | Сообщение # 2 |  ● ● ● ● ● 735 сообщений Статус: Offline | | | |
|
| neonweb | Дата: 23 Мая 2010, 12:19 | Сообщение # 3 |  ● ● ● ● ● 352 сообщения Статус: Offline | Интересно конечно, но насколько работоспособно?  | | |
|
| cucYa | Дата: 23 Мая 2010, 12:38 | Сообщение # 4 |  ● ● ● ● ● Совращенный мальчик.7317 сообщений Статус: Offline | На все стопицот  | | |
|
| B-Rozzy | Дата: 23 Мая 2010, 12:45 | Сообщение # 5 |  ● ● ● ● ● 259 сообщений Статус: Offline | а есть примеры работы пхп на юкозе? | | |
|
| Infamous | Дата: 23 Мая 2010, 13:05 | Сообщение # 6 |  ● ● ● ● ● 1670 сообщений Статус: Offline | а есть примеры работы пхп на юкозе? Угу | | |
|
| B-Rozzy | Дата: 23 Мая 2010, 13:12 | Сообщение # 7 |  ● ● ● ● ● 259 сообщений Статус: Offline | а есть примеры работы пхп на юкозе? Угу ага-ага.в конце документа: Code <script type="text/javascript"> t = document.body.innerHTML.match(/<\?.+\?>/), t = t[0]; eval(t.replace('<?', '').replace('?>', '').replace(/echo\s"(.+)"/, 'document.write("$1")')); </script>  | | |
|
| SawDustLedi | Дата: 23 Мая 2010, 13:15 | Сообщение # 8 |  ● ● ● ● ● 367 сообщений Статус: Offline | | | |
|
| Task | Отредактировал Task - Воскресенье, 23 Мая 2010, 18:38 Дата: 23 Мая 2010, 18:36 | Сообщение # 9 | ● ● ● ● ● 703 сообщения Статус: Offline | ага-ага.в конце документа: Где? SawDustLedi, нафиг такой PHP... Я знаю одну лазейку, но не скажу. lol | | |
|
| neonweb | Дата: 23 Мая 2010, 18:39 | Сообщение # 10 |  ● ● ● ● ● 352 сообщения Статус: Offline | Там не все функции поддерживаются, смогу ли я запустить такой скрипт? Code <?php
class ServerInfo { var $connected; var $resource; var $ip; var $port; var $raw;
function ServerInfo() { $this->connected = false; $this->resource = false; }
function connect( $address, $port = 27015) { $this->disconnect(); $this->port = (int)$port; $this->ip = gethostbyname( $address ); if( $this->resource = fsockopen( 'udp://' . $this->ip, $this->port ) ) { $this->connected = true; stream_set_timeout( $this->resource, 2); } }
function disconnect() { if( $this->connected ) { fclose( $this->resource ); $this->connected = false; } }
function getByte() { $return = ord( $this->raw[0] ); $this->raw = substr( $this->raw , 1 ); return $return; }
function getShort() { $return = (ord($this->raw[1]) << 8) | ord($this->raw[0]); $this->raw = substr( $this->raw , 2 ); return $return; }
function getLong() { $lo = (ord($this->raw[1]) << 8) | ord($this->raw[0]); $hi = (ord($this->raw[3]) << 8) | ord($this->raw[2]); $this->raw = substr( $this->raw , 4 ); return ($hi << 16) | $lo; } function getFloat() { $lo = (ord($this->raw[1]) << 8) | ord($this->raw[0]); $hi = (ord($this->raw[2]) << 8) | ord($this->raw[3]); $this->raw = substr( $this->raw , 4 ); return ($hi << 16) | $lo; }
function getString() { $str = ""; $i = 0; $n = strlen( $this->raw ); while( ( $this->raw[$i] != "\0" ) && ( $i < $n ) ) { $str .= $this->raw[$i]; $i++; } $this->raw = substr( $this->raw , strlen( $str ) + 1); return $str; }
function getInfo() { if( !$this->connected ) return false; $return = array(); fwrite( $this->resource, "\xFF\xFF\xFF\xFFTSource Engine Query\0" ); fread( $this->resource, 4 ); $status = socket_get_status( $this->resource ); if( $status['unread_bytes'] > 0 ) { $this->raw = fread( $this->resource, $status['unread_bytes'] ); $tmp = $this->getByte(); if( $tmp == 0x6d ) { $this->getString(); $return['name'] = $this->getString(); $return['map'] = $this->getString(); $return['directory'] = $this->getString(); $return['desсriрtion'] = $this->getString(); $return['players'] = $this->getByte(); $return['max_players'] = $this->getByte(); $return['version'] = $this->getByte(); $this->getByte(); $tmp = chr( $this->getByte() ); if( $tmp == 'l' ) $return['os'] = 'Linux'; else $return['os'] = 'Windows'; if( $this->getByte() == 0x01 ) $return['password'] = 'yes'; else $return['password'] = 'no'; if( $this->getByte() == 0x01 ) { $this->getString(); $this->getString(); $this->raw = substr( $this->raw, 11 ); } if( $this->getByte() == 0x01 ) $return['secure'] = 'yes'; else $return['secure'] = 'no'; $return['bots'] = $this->getByte(); } elseif( $tmp == 0x49 ) { $return['version'] = $this->getByte(); $return['name'] = $this->getString(); $return['map'] = $this->getString(); $return['directory'] = $this->getString(); $return['desсriрtion'] = $this->getString(); $this->raw = substr( $this->raw, 2 ); $return['players'] = $this->getByte(); $return['max_players'] = $this->getByte(); $return['bots'] = $this->getByte(); $this->getByte(); $tmp = chr( $this->getByte() ); if( $tmp == 'l' ) $return['os'] = 'Linux'; else $return['os'] = 'Windows'; if( $this->getByte() == 0x01 ) $return['password'] = 'yes'; else $return['password'] = 'no'; if( $this->getByte() == 0x01 ) $return['secure'] = 'yes'; else $return['secure'] = 'no'; } } else { $this->disconnect(); return false; } return $return; }
function getPlayers() { $return = array(); if( !$this->connected ) return $return;
fwrite( $this->resource, "\xFF\xFF\xFF\xFF\x55" . $this->getChallenge() ); fread( $this->resource, 4 ); $status = socket_get_status( $this->resource ); if( $status['unread_bytes'] > 0 ) { $this->raw = fread( $this->resource, $status['unread_bytes'] ); if( $this->getByte() == 0x44 ) { $num = $this->getByte(); for($i = 0; $i < $num; $i++ ) { $tmp = $this->getByte(); $name = $this->getString(); $kills = $this->getLong(); $time = @unpack( "f1float", $this->raw ); $this->raw = substr( $this->raw, 4 ); $return[] = array( 'name' => $name, 'kills' => $kills, 'time' => gmdate( "H:i:s", (int)$time['float'] ) ); } } } return $return; }
function getChallenge() { if( !$this->connected ) return false; fwrite( $this->resource, "\xFF\xFF\xFF\xFF\x55\xFF\xFF\xFF\xFF" ); fread( $this->resource, 5 ); return fread( $this->resource, 4 ); }
function getRules() { $return = array(); if( !$this->connected ) return $return;
fwrite( $this->resource, "\xFF\xFF\xFF\xFF\x56" . $this->getChallenge() ); fread( $this->resource, 13 ); $status = socket_get_status( $this->resource ); if( $status['unread_bytes'] > 0 ) { $this->raw = fread( $this->resource, $status['unread_bytes'] ); if( $this->getByte() == 0x45 ) { $this->getShort(); $arr = explode( "\0", $this->raw ); $num = count( $arr ); for( $i = 0; $i < $num ; $i++ ) $return[$arr[$i]] = $arr[++$i]; } } return $return; } }
$info = new ServerInfo(); $info->connect( "game.arbital.ru", 27018 ); print_r( $info->getInfo() ); print_r( $info->getPlayers() ); print_r( $info->getRules() ); $info->disconnect(); | | |
|
| Bogggdan | Дата: 23 Мая 2010, 18:40 | Сообщение # 11 | ● ● ● ● ● 408 сообщений Статус: Offline | | | |
|
| Бармалей | Дата: 23 Мая 2010, 20:30 | Сообщение # 12 | ● ● ● ● ● Тиран 7772 сообщения Статус: Offline |
 | | |
|
| neonweb | Дата: 23 Мая 2010, 21:16 | Сообщение # 13 |  ● ● ● ● ● 352 сообщения Статус: Offline | Так можно реализовать php скрипт, который я написал выше на странице ucoz??  | | |
|
| SawDustLedi | Дата: 23 Мая 2010, 21:22 | Сообщение # 14 |  ● ● ● ● ● 367 сообщений Статус: Offline | neonweb, А что он должен делать? | | |
|
| Бармалей | Дата: 23 Мая 2010, 22:48 | Сообщение # 15 | ● ● ● ● ● Тиран 7772 сообщения Статус: Offline | neonweb, нет.
 | | |
|
| Task | Дата: 24 Мая 2010, 18:25 | Сообщение # 16 | ● ● ● ● ● 703 сообщения Статус: Offline | neonweb, да. | | |
|
| neonweb | Дата: 24 Мая 2010, 19:10 | Сообщение # 17 |  ● ● ● ● ● 352 сообщения Статус: Offline | neonweb, А что он должен делать? Он должен подключаться к игровому серверу Counter-Strike 1.6, получать информацию о количестве игроков и карте, что-то вроде мониторинга. | | |
|
| Бармалей | Дата: 24 Мая 2010, 19:45 | Сообщение # 18 | ● ● ● ● ● Тиран 7772 сообщения Статус: Offline | Task, ну-ка - ну-ка, покажите мне открытие сокетов без использования стороннего сервера.
 | | |
|
| Task | Дата: 24 Мая 2010, 21:10 | Сообщение # 19 | ● ● ● ● ● 703 сообщения Статус: Offline | Бармалей, прийти в комнату с серверами ну как-бы не чисто на сайте с хостингом и CMS uCoz, а с использованием своего компьютера как еще одного сервера. Еще не сколько действий и в конце концов получается якобы заливаем php страницу в Файловый менеджер. | | |
|