Jump to content

Darkness Soul

Members
  • Posts

    133
  • Joined

  • Last visited

    Never

Posts posted by Darkness Soul

  1. You will get a parse error:
    [code]<?php    

    } else {  
      $load = 'welcome';    // -- if $_GET['load'] is not defined
    }    

    // loading from dir ** but this is not working

    elseif($load == "members") {  
          include "members/page1.php";  
       }
    ?> [/code]

    if {}
    else {}
    elseif {} (?)

    Why you're testin two times the same thing??
    In your switch, you have members, m/p1, m/p2.. in your code.. if members.. p1 e p2..

    Exemple what you want about that point of code.. =)

    D.Soul
  2. I think its may useful!! It's just my idea to how make your problem work.. refine its well..

    -- Little edit: they will be ok because of 2=2, change it to test ;)

    Enjoy, D.Soul

    [code]<?php
    // list of array field
        $arr_a = array ( '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' );
    // list of array values
        $arr_b = array ( '7' , '0' , '2' , '2' , '3' , '4' , '5' , '6' );
    // check how much they are, infinites or not
        $limit = count ( $arr_a );
    // variables.. start it..
        $test  = FALSE;
    // for each field with each own value
        for ( $counter = 0; $counter < $limit; $counter ++ )
        {
            if ( strtolower ( $arr_a[$counter] ) == strtolower ( $arr_b[$counter] ))
            {
    // test if its true.. they match??
                $test = TRUE;
            }
        }
    // Now, your code.. they match? join, dont mach? put a else there..
        if ( $test )
        {
            print 'Ok! =)';
        }
    ?>[/code]
  3. Hi guys,

    So, new ask to you.. really need a newbie help.. ^^"!

    When I print a multiple option select, and my form is sent, the $_POST just read the last one selected.. not the last click, the last down select.. a sample code like mine that's don't work too..:
    [code]<?php
        if ( $_POST['component_select'] != '' )
        {
            print $_POST['component_select'] ;
        }
    ?>
    <FORM action="teste.php" method="post">
    <P>
    <SELECT multiple size="10" name="component_select" STYLE="width: 500px;">
        <OPTGROUP label="Group 1">
            <OPTION value="Component_1_a">Component_1_1</OPTION>
            <OPTION value="Component_1_b">Component_1_2</OPTION>
            <OPTION value="Component_1_c">Component_1_3</OPTION>
        </OPTGROUP>
        <OPTGROUP label="Group 2">
            <OPTION value="Component_2_a">Component_2_1</OPTION>
            <OPTION value="Component_2_b">Component_2_2</OPTION>
            <OPTION value="Component_2_c">Component_2_3</OPTION>
        </OPTGROUP>
        <OPTION value="Component_3_a">Component_3</OPTION>
    </SELECT>
    <BR>
    <INPUT type="submit" value="Send"><INPUT type="reset">
    </P>
    </FORM>[/code]
    If I select all elements, its will print [b]Component_3_a[/b]...

    Thank you for any help.. =)

    D.Soul
  4. I've tryied it.. but..

    [code] Mensagens do MySQL : Documentação
    #1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT id FROM tbCategoria WHERE lcase(descricao)="esportes" LI [/code]
    =( unhappy..
  5. Guy.. thats a big-complexe one..

    [code]while ( !feof ( $arq_importacao ))
    {
        // Le os registros de uma linha
        $arq_registro = fgetcsv ( $arq_importacao , 1000 , "\t" , '"' );
        // Guarda a quantia de campos
        $num_campos = count ( $arq_registro );
        // Le os dados dos registros
        $rs_gravacao['categoria']        = 'SELECT id FROM tbCategoria    WHERE lcase(descricao)="'.        strtolower ( ltrim ( rtrim ( $arq_registro[0] ))) .'" LIMIT 1';
        $rs_gravacao['subcategoria']    = 'SELECT id FROM tbSubCategoria WHERE lcase(descricao)="'. fun_procura_array ( ltrim ( rtrim ( $arq_registro[1] ))) .'" LIMIT 1';
        ( strlen ( $arq_registro[2] ) > 0 ) ? $rs_gravacao['categoria1']    = 'SELECT id FROM tbCategoria    WHERE lcase(descricao)="'.        strtolower ( ltrim ( rtrim ( $arq_registro[2] ))) .'" LIMIT 1' : 0;
        ( strlen ( $arq_registro[3] ) > 0 ) ? $rs_gravacao['subcategoria1']    = 'SELECT id FROM tbSubCategoria WHERE lcase(descricao)="'. fun_procura_array ( ltrim ( rtrim ( $arq_registro[3] ))) .'" LIMIT 1' : 0;
        ( strlen ( $arq_registro[4] ) > 0 ) ? $rs_gravacao['categoria2']    = 'SELECT id FROM tbCategoria    WHERE lcase(descricao)="'.        strtolower ( ltrim ( rtrim ( $arq_registro[4] ))) .'" LIMIT 1' : 0;
        ( strlen ( $arq_registro[5] ) > 0 ) ? $rs_gravacao['subcategoria2']    = 'SELECT id FROM tbSubCategoria WHERE lcase(descricao)="'. fun_procura_array ( ltrim ( rtrim ( $arq_registro[5] ))) .'" LIMIT 1' : 0;
        $rs_gravacao['nomefantasia']    = ltrim ( rtrim ( $arq_registro[6] ));
        $rs_gravacao['endereco']        = ltrim ( rtrim ( $arq_registro[7] ));
        $rs_gravacao['numero']            = ltrim ( rtrim ( $arq_registro[8] ));
        $rs_gravacao['complemento']        = ltrim ( rtrim ( $arq_registro[9] ));
            ( $rs_gravacao['complemento'] == 'sem complemento' ) ? $rs_gravacao['complemento'] = '' : FALSE;
        $rs_gravacao['estado']            = 'SELECT id FROM tbEstados WHERE lcase(sigla)="'.  ltrim ( rtrim ( strtolower ( $arq_registro[10] ))) .'" LIMIT 1';
        $rs_gravacao['cidade']            = 'SELECT id FROM tbCidades WHERE lcase(cidade)="'. ltrim ( rtrim ( strtolower ( $arq_registro[11] ))) .'" LIMIT 1';
        $rs_gravacao['bairro']            = 'SELECT id FROM tbBairros WHERE lcase(bairro)="'. ltrim ( rtrim ( strtolower ( $arq_registro[12] ))) .'" LIMIT 1';
        $rs_gravacao['regiao']            = 'SELECT id FROM tbRegioes WHERE lcase(regiao)="'. ltrim ( rtrim ( strtolower ( $arq_registro[13] ))) .'" LIMIT 1';
        $rs_gravacao['cep']                = ltrim ( rtrim ( $arq_registro[14] ));
        $rs_gravacao['telefone']        = ltrim ( rtrim ( $arq_registro[15] ));
            ( strlen ( $rs_gravacao['telefone'] ) > 0 ) ? $rs_gravacao['telefone'] = '(19) '. substr ( $rs_gravacao['telefone'] , 0 , 4 ) .'-'. substr ( $rs_gravacao['telefone'] , -4 ) : FALSE;
        $rs_gravacao['telefone1']        = ltrim ( rtrim ( $arq_registro[16] ));
            ( strlen ( $rs_gravacao['telefone1'] ) > 0 ) ? $rs_gravacao['telefone1'] = '(19) '. substr ( $rs_gravacao['telefone1'] , 0 , 4 ) .'-'. substr ( $rs_gravacao['telefone1'] , -4 ) : FALSE;
        $rs_gravacao['fax']                = ltrim ( rtrim ( $arq_registro[17] ));
            ( strlen ( $rs_gravacao['fax'] ) > 0 ) ? $rs_gravacao['fax'] = '(19) '. substr ( $rs_gravacao['fax'] , 0 , 4 ) .'-'. substr ( $rs_gravacao['fax'] , -4 ) : FALSE;
        $rs_gravacao['800']                = ltrim ( rtrim ( $arq_registro[18] ));
            ( strlen ( $rs_gravacao['800'] ) > 0 ) ? $rs_gravacao['800'] = '0800 '. substr ( $rs_gravacao['800'] , 0 , 3 ) .'-'. substr ( $rs_gravacao['800'] , -4 ) : FALSE;
        $rs_gravacao['palavrachave']    = ltrim ( rtrim ( $arq_registro[19] ));
        // Executa apenas se ouver os campos obrigatórios
        if ((( $rs_gravacao['categoria']    ) != '' ) &&
            (( $rs_gravacao['subcategoria'] ) != '' ) &&
            (( $rs_gravacao['nomefantasia'] ) != '' ))
        {
            // Verifica se a empresa já existe
            $rs_emp_sql        = 'SELECT id, endereco, numero FROM tbEmpresas WHERE lcase(nomefantasia)="'. $rs_gravacao['nomefantasia'] .'" LIMIT 1';
            $rs_emp_query    = mysql_query ( $rs_emp_sql , $conn );
            // Monta a string de conexão para inserção
            $rs_str_sql  = ' INSERT INTO tbEmpresas ';
            $rs_str_sql .= ' ( idcategoria , idsubcategoria , idcategoria2 , idsubcategoria2 , idcategoria3 , idsubcategoria3 , nomefantasia , endereco , numero , complemento , idestado , idcidade , idbairro , idregiao , cep , telefone , telefone2 , fax , tel0800 , palavrachave ) ';
            $rs_str_sql .= ' VALUES ( ';
            // Testa se a empresa existe
            if ( mysql_num_rows ( $rs_emp_query ) > 0 )
            {
                // Verifica se possui novo endereço ou é alteração
                $rs_emp_dados = mysql_fetch_array ( $rs_emp_query );
                if (( strtolower ( $rs_emp_dados['endereco'] ) == strtolower ( $rs_gravacao['endereco'] )) &&
                    ( $rs_emp_dados['numero'] == $rs_gravacao['numero'] ))
                {
                    // Monta a string de conexão para alteração
                    $rs_str_sql  = ' UPDATE tbEmpresas SET ';
                    $bool_str_insupd = 'U';
                }
                else
                {
                    $bool_str_insupd = 'A';
                }
            }
            // Verifica se é inserção ou alteração
            if ( $bool_str_insupd == 'U' )
            {
                $cont_max_update ++;
                // Montagem da string de conexão
                if ( strlen ( $rs_dados['idcategoria'] <= 0 ))
                  {
                      $rs_str_sql .= ' idcategoria='.  $rs_gravacao['categoria']  .',  idsubcategoria='.  $rs_gravacao['subcategoria']  .', ';
                      $rs_str_sql .= ' idcategoria2='. $rs_gravacao['categoria1'] .',  idsubcategoria2='. $rs_gravacao['subcategoria1'] .', ';
                      $rs_str_sql .= ' idcategoria3='. $rs_gravacao['categoria2'] .',  idsubcategoria3='. $rs_gravacao['subcategoria2'] .', ';
                  }
                  elseif ( strlen ( $rs_dados['idcategoria2'] <= 0 ))
                  {
                      $rs_str_sql .= ' idcategoria2='. $rs_gravacao['categoria']  .',  idsubcategoria2='. $rs_gravacao['subcategoria']  .', ';
                      $rs_str_sql .= ' idcategoria3='. $rs_gravacao['categoria1'] .',  idsubcategoria3='. $rs_gravacao['subcategoria1'] .', ';
                      $rs_str_sql .= ' idcategoria4='. $rs_gravacao['categoria2'] .',  idsubcategoria4='. $rs_gravacao['subcategoria2'] .', ';
                  }
                  elseif ( strlen ( $rs_dados['idcategoria3'] <= 0 ))
                  {
                      $rs_str_sql .= ' idcategoria3='. $rs_gravacao['categoria']  .',  idsubcategoria3='. $rs_gravacao['subcategoria']  .', ';
                      $rs_str_sql .= ' idcategoria4='. $rs_gravacao['categoria1'] .',  idsubcategoria4='. $rs_gravacao['subcategoria1'] .', ';
                      $rs_str_sql .= ' idcategoria5='. $rs_gravacao['categoria2'] .',  idsubcategoria5='. $rs_gravacao['subcategoria2'] .', ';
                  }
                  elseif ( strlen ( $rs_dados['idcategoria4'] <= 0 ))
                  {
                      $rs_str_sql .= ' idcategoria4='. $rs_gravacao['categoria']  .',  idsubcategoria4='. $rs_gravacao['subcategoria']  .', ';
                      $rs_str_sql .= ' idcategoria5='. $rs_gravacao['categoria1'] .',  idsubcategoria5='. $rs_gravacao['subcategoria1'] .', ';
                  }
                  else
                  {
                      $rs_str_sql .= ' idcategoria5='. $rs_gravacao['categoria']  .',  idsubcategoria5='. $rs_gravacao['subcategoria']  .', ';
                  }
                // Continuação da expressao
                $rs_str_sql    .= ' nomefantasia="'. $rs_gravacao['nomefantasia']     .'",
                                    endereco="'.     $rs_gravacao['endereco']     .'",
                                    numero="'.       $rs_gravacao['numero']       .'",
                                    complemento="'.  $rs_gravacao['complemento']  .'",
                                    idestado='.     $rs_gravacao['estado']       .',
                                    idcidade='.     $rs_gravacao['cidade']       .',
                                    idbairro='.     $rs_gravacao['bairro']       .',
                                    idregiao='.     $rs_gravacao['regiao']       .',
                                    cep="'.          $rs_gravacao['cep']          .'",
                                    telefone="'.     $rs_gravacao['telefone']     .'",
                                    telefone2="'.    $rs_gravacao['telefone1']    .'",
                                    fax="'.          $rs_gravacao['fax']          .'",
                                    tel0800="'.      $rs_gravacao['800']          .'",
                                    palavrachave="'. $rs_gravacao['palavrachave'] .'",
                                    cliente="N", ativo="S"
                                    WHERE id="'. $rs_emp_dados['id'] .'" LIMIT 1';
                
                $rs_str_query    = mysql_query ( $rs_str_sql , $conn );
                // Verifica erro
                if ( !$rs_str_query )
                {
                    print '<hr>' . mysql_error() .'<br><br>'. $rs_str_sql;
                }
                else
                {
                    // Aumenta o contador
                    $cont_num_update ++;
                }
            }
            else
            {
                ( $bool_str_insupd == 'A' ) ? $cont_max_insupd ++ : $cont_max_insert ++;
                // Montagem da string de conexão
                $rs_str_sql .= $rs_gravacao['categoria'] .' ,
                            '. $rs_gravacao['subcategoria'] .' ,
                            '. $rs_gravacao['categoria1'] .' ,
                            '. $rs_gravacao['subcategoria1'] .' ,
                            '. $rs_gravacao['categoria2'] .' ,
                            '. $rs_gravacao['subcategoria2'] .' ,
                           "'. $rs_gravacao['nomefantasia'] .'" ,
                           "'. $rs_gravacao['endereco'] .'" ,
                           "'. $rs_gravacao['numero'] .'" ,
                           "'. $rs_gravacao['complemento'] .'" ,
                            '. $rs_gravacao['estado'] .' ,
                            '. $rs_gravacao['cidade'] .' ,
                            '. $rs_gravacao['bairro'] .' ,
                            '. $rs_gravacao['regiao'] .' ,
                           "'. $rs_gravacao['cep'] .'" ,
                           "'. $rs_gravacao['telefone'] .'" ,
                           "'. $rs_gravacao['telefone1'] .'" ,
                           "'. $rs_gravacao['fax'] .'" ,
                           "'. $rs_gravacao['800'] .'" ,
                           "'. $rs_gravacao['palavrachave'] .'" )';
                // Verifica erro
                if ( !$rs_str_query )
                {
                    print '<hr>' . mysql_error() .'<br><br>'. $rs_str_sql;
                }
                else
                {
                    // Aumenta o contador
                    ( $bool_str_insupd == 'A' ) ? $cont_num_insupd ++ : $cont_num_insert ++;
                }
            }
        }
        else
        {
            $cont_num_erros ++;
        }
        unset ( $rs_gravacao );
    }[/code]
  6. Hi Guys,

    I have a newbie question... I think..

    I have a import file that need to read some information, retrieve they ID from other tables, and record the data into the view table.

    My sql line command is exactly like that:
    [code]INSERT INTO
        tbl_Company
        ( idcategoria , idsubcategoria , idcategoria2 , idsubcategoria2 , idcategoria3 , idsubcategoria3 , nomefantasia , endereco , numero , complemento , idestado , idcidade , idbairro , idregiao , cep , telefone , telefone2 , fax , tel0800 , palavrachave )
    VALUES
        ( SELECT id FROM tbCategoria WHERE lcase(descricao)="esportes" LIMIT 1 ,
        SELECT id FROM tbSubCategoria WHERE lcase(descricao)="Academias de Ginástica" LIMIT 1 ,
        , , , , "academia corpo e lazer" , "r. joão cancian" , "76" , "Sem Registro" ,
        SELECT id FROM tbEstados WHERE lcase(sigla)="sp" LIMIT 1 ,
        SELECT id FROM tbCidades WHERE lcase(cidade)="hortolândia" LIMIT 1 ,
        SELECT id FROM tbBairros WHERE lcase(bairro)="parque hortolândia" LIMIT 1 ,
        SELECT id FROM tbRegioes WHERE lcase(regiao)="sem região" LIMIT 1 ,
        "" , "(19) 3865-1328" , "" , "" , "" , "academia ginástica;" )[/code]
    My script don't return a mysql_error(), but in the phpmyadmin, it said have an error..

    --
    A little edit: I'm trying to use it in the UPDATE too.
    --

    Thanks for any help.

    D.Soul
  7. I've built a code, and its apper work fine.. dont clue here because it have 215 lines (with coments), so i can write a tutorial if someone need..

    but i still have a problem..

    I need to know what kind of file the mail is attaching.. my code to do this:

    [code]    if ( strtoupper ( $arq_extensao ) == 'PDF' )
        {
            $arq_aplicacao = 'pdf';
        }
        elseif ( strtoupper ( $arq_extensao ) == 'DOC' )
        {
            $arq_aplicacao = 'msword';
        }[/code]
    But, i need a function to take the file extension ($arq_extensao).. this if will filter the mime "application/[type]".

    Have some function to retrieve these extension?

    Thanks, D.Soul
  8. Hi guys,

    I've performed a search but, unhappy, don't find topics with this problem.

    I need to send a mail.. like newsletter, but with attachment!

    I read somewhere about use mimetype to send images, but long time ago.. to send files, any kind of files.. what I suppose to do?

    Thank you.

    D.Soul
  9. Hi guys,

    I was mak'ng a dictionary function for portuguese language, that's replace wrong words for they correct word, like "agua" for "água".

    My function:
    [code]function fun_dictionary ( $fun_string )
    {
        $str_wrong  = array( "DIRECAO" , "HIDRAULICA" , "TERMICO" );
        $str_right = array( "direção" , "hidráulica" , "térmico" );
        $fun_string = ucwords ( strtolower ( preg_replace ( $str_wrong, $str_right, $fun_string )));
        return $fun_string;
    }[/code]
    But, when I call it, like that:
    [code]print $str_text = fun_dictionary ( 'DIRECAO HIDRAULICA, SENSOR TERMICO' );[/code]
    It's print like this:
    [b]Direcao Hidraulica, Sensor Termico[/b]
    What I suppose to do? Where is my fault?

    Thanks, anyway.. D.Soul
  10. I've tried to built it on MS Access, and it give me this code, but still don't working..

    [code]        $str_sql        = '
    SELECT
        user_flag.id
    FROM
    (
        user_group
        INNER JOIN
            user_flag
        ON
            user_group.id = user_flag.idgrupo
    )
    INNER JOIN
        user_data
    ON
    (
        user_flag.id = user_data.id
    )
    AND
    (
        user_group.id = user_data.id_grupo
    )
    WHERE
        user_data.id = '. $int_id .'
    LIMIT
        1
            ';[/code]
  11. Hi guys,

    When the user login, my auth-code save some information in a session, one of these information is the user flag.

    I have 3 tables:
    * user_data
    * user_group
    * user_flag

    I verify the login/pass in [user_data], so, I start to record the session. I record:

    * usr_name
    * usr_id
    * usr_group
    * usr_flag

    My problem is with the flag.. A flag just have a group_id with it. So, i was using a INNER JOIN to retrieve this flag_id, but not so happy, something was wrong.

    My code:

    [code]    $str_sql = '
    SELECT
        user_flag.id AS id
    FROM
    (
        user_flag
        INNER JOIN
        (
            user_group
            INNER JOIN
                user_data
            ON
                user_group.id = user_data.id_group
        )
        ON
            user_flag.id_group = user_group.id
    )
    WHERE
        user_data.id = '. $int_id .'
    LIMIT
        1
        ';[/code]
    So, if someone know what I do wrong, I will be greatful, I'm new in mysql.. ^^"!

    Bye.
  12. I think I don't told that clear.. (mine bad english x] )

    I have one DB in the server X, I have to read the data and write into the DB at server H.

    So, I export it to a [data.txt] file, because I need to rewrite some data and turn it compatible with the new DB.

    The "textarea" i've been said is just a BLOB in the old DB, but when i write it in the file, this write with that \n and \t characters.

    I export the file, read and replace the adaptations, and import to new DB, in theory.

    This old-blob give me a headshake with itself string.. I need to replace the \n for new lines to write and lost the \t (tabs), so I can write it into the new-blob..

    Clean now? sorry for bad sentences.. ^^"!

    D.Soul
  13. Yo,

    Well, this time, something new (to me)..

    I was reading a file to export it to db, and the file have a textarea with some \n, \t, \n\t, \t\n, (...).
    I want to write it in a blob in the db.. but.. its export wrong..

    I've tried to use ltrim, rtrim, trim, but its only remove left and right .. not int the middle..

    So, i've seen the preg_replace in the documentation, but ive never saw it before..

    Someone help me?

    Thanks

    D.Soul
  14. [!--quoteo(post=358889:date=Mar 27 2006, 11:20 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Mar 27 2006, 11:20 AM) [snapback]358889[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    I'm not sure what you mean by security -- I'd be more concerned about how you're sending the passcode itself.
    [/quote]

    Someone told me that my sql isnt secure, someone can use it as a vulnerability...
  15. Hi,

    I've reading some references about mysql, but unlucky..

    I've been develop a login system, this login is a form that call a page "action.php" where the validation is executed..

    The system work wells, but, i like to know about the securit.. my select is like it:

    [code]$sql = ' SELECT * FROM tbUsers WHERE login="'. $login .'" AND pass="'. $pass .'" ';[/code]
    is this the best security form to use a login system? please, if its securyless, i want some help..

    Thanks folks,

    Soul
  16. Yo guys,

    Well, new problem.. how I need to do to make a check all option?

    My form is like a security form..
    each cheackbox have an unique name.. like "read_a" and "write_h"..

    [code]module A [_]read [_]write
    module B [_]read [_]write
    module C [_]read [_]write
    (...)
    module V [_]read [_]write
    module X [_]read [_]write
    module Z [_]read [_]write

    All Mods [_]read [_]write[/code]
    "simple" like that..

    ^~ Thank you so much for any help..

    Soul
  17. Thank you!

    That's work fine!!!!

    [code]$path = pathinfo ( $_SERVER['PHP_SELF'] );
    $path = basename ( $path['basename'] , '.php' );
    if (( $path != 'index' ) && ( $path != 'main' ))
    {
       //code
    }[/code]

    Cya!
  18. Hi guys,

    I have the follow problem; when I'm at index.php or main.php, I don't want to my include toolbar.php show the [_back_] option.. and ALL my site have this include.

    So I think something like this: "If I get my path with the file name, I can test it to check if it's 'index.php' or 'main.php', so, if it's true, i don't show this option."

    But.. how can I do it?

    I've tryed to search it at function list (php5 documentation), but, don't found nothing..

    I'm glad someone may help me! ^-^

    Thank you a lot..

    D. Soul
  19. Hi,

    Well, I have a big problem here..

    I'm making a file that import a file .htm, in this file, have a table (never im same line of code) with id="tab"; the row of titles is generated with all [td id="til"] and all data row have all [td id="lin"]..

    So, i need to read all data in table and print new table in the site..

    Someone have any idea, 'howto'?

    Thank you..
  20. Yo,

    That check system what this forum use is open? I like the system to check usernames, password, e-mail..

    How complicated is to make one like that?? Not equal (unlike copy-paste).. I'm interested in know how to use that =)..

    o.o If thats a private code.. sorry for my ask.. have no intention to make someone mad..

    ^^" thanks all
  21. If am I wrong, please tell me.. but, i think..

    When you use " ", the PHP allow you to write variables inside, when you use ' ', you are not allowed to.

    Like your include, test both of these:
    [code]
    // may work
    require ( "$page.php" );
    require ( $page .'.php' );

    // may not work
    require ( '$page' . '.php' );
    require ( '$page.php' ); [/code]
    =)
  22. Yep, that's the cool side of the for.. code!

    You aways can use it for all pages with one code.. something like..

    [code]<?php

       // Before headers
       $page = $_GET [ '$page' ];

       // Now, test the URL query for security {thanks another topic}
       if ( !is_file ( "$page.php" ) && $page != "" )
       {
          // File not found!!!
          header ( "location: index.php" );
       }
       // Are you in index?
       elseif ( $page == "" )
       {
          $page = "home";
       }

       // Inside <title></title> tags
       print "You are in ". $page";

       // Calling the specific page
       include ( "$page.php" );

       // (...)
    ?>[/code]

    =)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.