ANTICHAT — форум по информационной безопасности, OSINT и технологиям
ANTICHAT — русскоязычное сообщество по безопасности, OSINT и программированию.
Форум ранее работал на доменах antichat.ru, antichat.com и antichat.club,
и теперь снова доступен на новом адресе —
forum.antichat.xyz.
Форум восстановлен и продолжает развитие: доступны архивные темы, добавляются новые обсуждения и материалы.
⚠️ Старые аккаунты восстановить невозможно — необходимо зарегистрироваться заново.
 |
|

04.02.2009, 00:09
|
|
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме: 9257858
Репутация:
979
|
|
Curl используй он легче,саму форму кинь суда поможем.
|
|
|

04.02.2009, 00:10
|
|
Members of Antichat - Level 5
Регистрация: 28.05.2007
Сообщений: 729
Провел на форуме: 5571194
Репутация:
1934
|
|
Сообщение от ChaaK
AFoST, post-запрос в теле доллжен быть, т.е после \r\n\r\n
vikseriq, когда нет Post-данных, content-length не обязателььна
да я знаю) у меня прост кусок кода точь-в-точь как этот, но с ооп. я на быструю руку в блокноте криво исправил.
у меня такой вот был:
PHP код:
$this->request =
"POST http://".$this->host.$this->pathFile." HTTP/1.0\r\n".
"host: ".$this->host."\r\n".
"Connection: close\r\n".
"Content-type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".strlen($this->var)."\r\n".
"\r\n".
$this->var;
__________________
Появляюсь редко. Важные дела в реале.
Последний раз редактировалось AFoST; 04.02.2009 в 01:44..
|
|
|

04.02.2009, 00:12
|
|
Познавший АНТИЧАТ
Регистрация: 24.06.2008
Сообщений: 1,996
Провел на форуме: 6075534
Репутация:
2731
|
|
rushter,
Код:
<form action="" method="post">
<b>Nick:</b> <input name="name" type="text" value="">
</form>
|
|
|

04.02.2009, 00:17
|
|
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме: 9257858
Репутация:
979
|
|
PHP код:
$post = "name=john";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://site.com/script.php");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$out = curl_exec($ch);
echo $out;
Писал по памяти,могут быть ошибки.
|
|
|

04.02.2009, 00:49
|
|
Познавший АНТИЧАТ
Регистрация: 24.06.2008
Сообщений: 1,996
Провел на форуме: 6075534
Репутация:
2731
|
|
Эх, спс конечно, но мне надо именно на фсокопен, ибо курла нету...
|
|
|

04.02.2009, 00:57
|
|
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме: 9257858
Репутация:
979
|
|
поставить то 3 минуты
http://slil.ru/26613387
php.ini
extension=php_curl.dll
|
|
|

04.02.2009, 01:01
|
|
Reservists Of Antichat - Level 6
Регистрация: 25.04.2008
Сообщений: 827
Провел на форуме: 2769640
Репутация:
1304
|
|
rushter Поставь так же без палева на хост заблокированным dl() и без прямого доступа к php.ini
mailbrush Выше - куча оберток для пост запросов. Берешь сниффер, в конце концов, и копируешь 1в1 запрос
|
|
|

04.02.2009, 03:57
|
|
Постоянный
Регистрация: 05.12.2004
Сообщений: 647
Провел на форуме: 1698585
Репутация:
818
|
|
Tigger
PHP код:
<?php
$email = 'email@rambler.ru';
$pass = '123';
$from = '1';
$to = '5';
set_time_limit(0);
$ua="User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Widows NT)";
$url = "http://vkontakte.ru/login.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "success_url=&fail_url=&try_to_login=1&email=$email&pass=$pass");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, "./cook");
curl_setopt($ch, CURLOPT_COOKIEJAR, "./cook");
$res = curl_exec($ch);
curl_close($ch);
$a = strpos($res, 'OK' );
if ($a > 0)
{
echo "Незалогинились =(<br>";
exit;
}
$b = strpos($res, 'Found' );
if ($b > 0)
{
echo "<b>Удачно залогинились, приступаем к парсингу...</b><br>";
}
for($i = $from; $i <= $to; $i++)
{
$url_p = "http://vkontakte.ru/search.php?id=$i";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_p);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "./cook");
curl_setopt($ch, CURLOPT_COOKIEJAR, "./cook");
$res_p = curl_exec($ch);
curl_close($ch);
preg_match('#<div style=\"overflow: hidden;\">(.*?)</div>#i',$res_p,$name);
$id = explode("php?",$url_p);
echo $id[1].":".$name[1]."<br>";
}
echo "<b>Работа окончена</b>";
?>
Результат:
Удачно залогинились, приступаем к парсингу...
id=1:Павел Дуров
id=2:Александра Владимирова
id=3:Вячеслав
Работа окончена
Ну как видиш в первом курле я добавил сохранение кукисов в файл, в втором ети куки читаються, как бы сессия продолжается. Добавил цикл и при помощи регулярки ищу Имена по профилям:
PHP код:
preg_match('#<div style=\"overflow: hidden;\">(.*?)</div>#i',$res_p,$name);
Собсна все, думаю понятно.
ЗЫ как видиш первые 4 строки ето как бы конфиг:
PHP код:
$email = 'email@rambler.ru';
$pass = '123';
$from = '1';
$to = '5';
Мыло и пасс, с которых логиниться. А так же 2 переменные, с какого id начинать и каким заканчивать.
Последний раз редактировалось b3; 04.02.2009 в 11:44..
|
|
|

04.02.2009, 04:18
|
|
Участник форума
Регистрация: 06.06.2006
Сообщений: 163
Провел на форуме: 1025198
Репутация:
11
|
|
Доброго всем времени суток.
Снова прошу помощи у меня опять возникла проблема с $this.
PHP код:
<?php
include_once("classes/DBManager.php");
include_once("PEAR.php");
class DBObject {
var $DBManager;
var $__table;
var $__keyColumn;
var $data = array();
var $view;
var $_isLoaded = false;
var $_changedColumns = array();
/**
* Constructor
*
* Creates a new DBObject
* if $objectId is specified gets data from database
*
* @param DBManager &$DBManager instance of DBManager
* @param mixed $objectId identity of object instance in database
* @access public
*/
function DBObject(&$DBManager, $objectId=null) {
$this->DBManager =& $DBManager;
if ($objectId !== null) {
$this->objectId = $objectId;
$this->get($objectId);
}
}
/**
* Gets data of current object from database and put it into class variables
*
* @param mixed $objectId identity of object instance in database
* @access public
*/
function get($objectId=null, $fieldsArray=array()) {
if ($objectId !== null) {
$this->objectId = $objectId;
}
if (is_array($fieldsArray) and sizeof($fieldsArray)>0) {
$fieldList = implode(',', $fieldsArray);
} else {
$fieldList = "*";
}
if (isset($this->objectId)) {
$this->data = $this->DBManager->SingleRowQuery("SELECT $fieldList FROM `{$this->__table}` WHERE {$this->__table}.{$this->__keyColumn}='{$this->objectId}'");
if ($this->data) {
$this->_isLoaded = true;
return true;
}
}
return false;
}
/**
* Stores data of current object from class variables into database
*
* @access public
*/
function insert() {
if (!isset($this->objectId)) {
$this->$objectId = $this->generateId(); <<-- строчка с ошибкой
}
$setClause = $this->_prepareSetClause();
if (strlen($setClause)>0) {
$sql = "INSERT INTO `{$this->__table}` SET $setClause ";
// echo "$sql<br>";
return $this->DBManager->ExecuteQuery($sql);
}
return false;
}
/**
* Updates data of current object from class variables into database
*
* @access public
*/
function update() {
if (isset($this->objectId)) {
$setClause = $this->_prepareSetClause();
if (strlen($setClause)>0) {
return $this->DBManager->ExecuteQuery("UPDATE `{$this->__table}` SET $setClause WHERE {$this->__table}.{$this->__keyColumn}='{$this->objectId}'");
}
}
return false;
}
/**
* Deletes current object in database and unsets class variables
*
* @access public
*/
function delete() {
if (isset($this->objectId)) {
return $this->DBManager->ExecuteQuery("DELETE FROM `{$this->__table}` WHERE {$this->__table}.{$this->__keyColumn}='{$this->objectId}'");
}
return false;
}
function getVariable($variableName) {
if ($variableName) {
if (in_array($variableName, array_keys($this->data))) {
return $this->data[$variableName];
}
}
return null;
}
function setVariable($variableName, $variableValue) {
$this->_changedColumns[] = $variableName;
$this->data[$variableName] = $variableValue;
}
function increaseVariable($variableName, $increaseValue) {
$this->setVariable($variableName, $this->getVariable($variableName)+$increaseValue);
}
function decreaseVariable($variableName, $decreaseValue) {
$this->setVariable($variableName, $this->getVariable($variableName)-$decreaseValue);
}
function removeVariable($variableName) {
if ($variableName) {
if (in_array($variableName, array_keys($this->data))) {
unset($this->data[$variableName]);
}
}
}
function isVariableEquals($variableName, $value) {
return ($this->getVariable($variableName) == $value);
}
function generateId() {
$id = '';
for( $i=0;$i<9;$i++ ) {
$id .= strval(rand(0,9));
}
return $id;
}
function _prepareSetClause() {
$setClause = '';
if ($this->_isLoaded) {
if (sizeof($this->_changedColumns)>0) {
foreach ($this->_changedColumns as $columnName) {
if ($columnName != $this->__keyColumn and strval(intval($columnName))!=$columnName) {
$setClause .= "{$this->__table}.$columnName = '".mysql_escape_string($this->getVariable($columnName))."',";
}
}
$setClause = substr($setClause,0,-1);
}
} else {
if (sizeof($this->data)>0) {
foreach ($this->data as $columnName=>$columnValue) {
if ($columnName != $this->__keyColumn and strval(intval($columnName))!=$columnName) {
$setClause .= "{$this->__table}.$columnName = '".mysql_escape_string($columnValue)."',";
}
}
$setClause = substr($setClause,0,-1);
}
}
return $setClause;
}
function getView($templateFile="index.html") {
// require_once 'HTML/Template/Flexy.php';
/* $flexy = new HTML_Template_Flexy();
if ($flexy->compile($templateFile)===true) {
$output = $flexy->bufferedOutputObject($this);
}
return $output;*/
}
function lockTable() {
return;
}
function unlockTable() {
return;
}
function getSystemParam($param)
{
$SQLQuery = "select $param from system_parameters";
$res = $this->DBManager->SingleRowQuery($SQLQuery);
return $res[0];
}
function getItemNameField()
{
$lang = $this->_app_voc->words['LANG'];
if ($lang == 'ENG')
{
return 'name_eng';
}
else if ($lang == 'RUS')
{
return 'name';
}
}
function getNameField()
{
$lang = $this->_app_voc->words['LANG'];
if ($lang == 'ENG') return 'name_eng';
else if ($lang == 'RUS') return 'name_rus';
}
function getDescrField()
{
$lang = $this->_app_voc->words['LANG'];
if ($lang == 'ENG') return 'descr_eng';
else if ($lang == 'RUS') return 'descr_rus';
}
function getRaceName($race)
{
$name_field = $this->getNameField();
$sql = "select $name_field from Alignments where al_name = '$race'";
$name = $this->DBManager->SingleRowQuery($sql);
return $name[0];
}
function _safe_symbol($text)
{
$text = str_replace('&', '', $text);
return $text;
}
}
?>
подскажите в чём ошибка в строчке $this->$objectId = $this->generateId();
|
|
|

04.02.2009, 09:56
|
|
Banned
Регистрация: 30.01.2009
Сообщений: 28
Провел на форуме: 221135
Репутация:
40
|
|
Нужна функция быстрого поиска в файле.
Т.е. file_search (string filename, string word) возвращать должна указатель на начало слова в файле в случае совпадения, в случае отсутсвия совпадения - false. вообщем аналог array_search ( mixed needle, array haystack [, bool strict] ) только не для массива а для файла.
Условия:
1. максимальная скорость работы после перевода php->exe.
2. отсутсвие органичений на размер оперативной памяти и длинну файла.
3. размер искомого слова не больше 255 байт.
4. как только 1 совпадение найдено поиск прекращается.
P.S. Может есть у кого готовая такая?
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|