• User Attivo

    @Ture_70 said:

    ma...il login mi funziona...mi entra tranquillamente nella pagina materie.php (che è protetta)...nella pagina materie.php sono linkate diverse pagine 8sempre del mio sito, ma in cartelle diverse) e praticamente vorrei sapere come fare per proteggere queste pagine....


    prova a mettere nelle tue pagine che vuoi proteggere
    [PHP]
    if(!isset($_SESSION['username']))
    {
    $messaggio=urlencode("Ti consiglio di autenticarti");
    header('location:'.lo percorso.php'.'?msg='.$messaggio);
    exit;
    }
    [/PHP]

    mettendo sempre prima i file di connessione

    fammi sapere

    ciao


  • User

    "mettendo sempre prima i file di connessione"...cosa significa??? (scusa la mia ignoranza)


  • User Attivo

    @Ture_70 said:

    "mettendo sempre prima i file di connessione"...cosa significa??? (scusa la mia ignoranza)

    penso che tu abbia un file config oppure conn.php
    [PHP]
    require 'config.php';
    require 'connect.php';
    [/PHP]

    cmq prova pure senza e vedi che dice

    ciao


  • User

    si...ho un file config-clas.php


  • User

    è un pezzo di codice php giusto??? quindi nelle pagine metto questo:
    [php]
    require ('config-clas.php');
    [/php]

    il file config-clas.php si trova in una cartella, quindi dovrei mettere:
    [php]
    require ('indirizzo_del_file/config-clas.php');
    [/php]
    ???????????????????????????????????


  • User Attivo

    si il percorso deve essere giusto del file config
    ma hai già provato?

    non dovrebbe farti entrare anche scrivendolo nella barra dell'indirizzo


  • User

    no...ora provo...cmq già in anticipo ti dico grazie per l' interesse....ti faccio sapere tra 2 minuti...il tempo che lo faccio.


  • User

    mi dice questo:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /www/netsons.org/ture70/web/classe/chimica/orale_chimica.php on line 7


  • User

    praticamente da errore qui:
    [php]
    header('location:'.lo percorso.php'.'?msg='.$messaggio);
    [/php]

    al posto di "lo percorso" ho provato a inserire sia index.php sia orale_chimica.php ma da sempre lo stesso errore


  • User

    ok, risolto....(per sbaglio avevo cancellato un punto) però ora mi dà pagina completamente bianca...
    ho inserito il codice php a inizio pagina...prima di tutto....va bene???


  • User Attivo

    @Ture_70 said:

    praticamente da errore qui:
    [php]
    header('location:'.lo percorso.php'.'?msg='.$messaggio);
    [/php]

    al posto di "lo percorso" ho provato a inserire sia index.php sia orale_chimica.php ma da sempre lo stesso errore

    dovresti mettere il persorso giusto dove vuoi mandarlo

    ti scrivo la sintassi giusta
    [PHP]
    header('location:'.'watch/accept.php'.'?msg='.$messaggio);
    [/PHP]


  • User

    si...quello l' ho risolto...ora però mi da pagina completamente bianca.... e se provo a controllare l' html della pagina c'è scritto solo:
    [html]
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD>
    <BODY></BODY></HTML>
    [/html]

    mentre la pagina che ho pubblicato io era piena di codice....


  • User Attivo

    puoi scrivermi cosa hai fatto nelle pagine che vuoi proteggere?


  • User

    certo....te ne invio una...
    orale_chimica.php
    [html]
    <?php
    require ('ture70.netsons.org/config-clas.php');

    if(!isset($_SESSION['username']))
    {
    $messaggio=urlencode("Ti consiglio di autenticarti");
    header('location:'.'ture70.netsons.org/index.php'.'?msg='.$messaggio);
    exit;
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>orali_chimica</title>
    </head>
    <body bgcolor="black">
    <center>
    <img src="">
    <img src="">
    <img src="">
    </center>
    <br>
    <center> <font color="yellow" size="24"> SETTEMBRE </font> </center>
    <center> <table border="1" width="650" height="350">
    <td width="15%"> <center> <font color="blue"> GIORNO </font> </center> </td>
    <td width="15%"> <center> <font color="blue"> INTERROGATI </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 15 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 16 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 17 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 18 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 19 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 20 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 22 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 23 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 24 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 25 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 26 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 27 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 29 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    <tr>
    <td width="15%"> <center> <font color="yellow"> 30 </font> </center> </td>
    <td width="85%"> <center> <font color="yellow"> #### - #### </font> </center> </td>
    </table> </center>
    </body>
    </html>
    [/html]

    La babella non è una sola (come vedi qui, ma in tutto sono 10) compresa questa.

    PS: Ho dovuto levare i link perchè nn sn un utente premium


  • ModSenior

    E' normale che se scrivi direttamente l'url acceddi, perchè sei comunque loggato, se fai il logout distruggi la sessione e quindi il controllo vede la variabile di sessione come non settata effettuando il redirect.


  • User

    nn ho inserito il logout perchè non mi seriva...perfavore...se ti do il link, puoi provare tu??? e mi dici se ti fa entrare o no???


  • ModSenior

    se non fai il logout, e quindi la sessione non viene distrutta rimani loggato e hai accesso alla pagina, quindi dovresti creare una pagina di logout.
    Puoi provare tu stesso eliminando i cookie del browser, cosi da sloggarti...


  • User

    😢:x...ho cancellato tutto....cookie, file temporanei, cronologia...tutto!! eppure mi ci fa entrare...se nn mi credi, controlla tu stesso:
    ture70.netsons.org/materie.php (tu nn sei registrato nel mio database)
    PS: prima ci hakkattp2punti//vuvuvu (non possoscrivere i link perchè nn sn utente premium)
    grazie per l' interesse.


  • ModSenior

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /www/netsons.org/ture70/web/index.php on line 20


  • User

    cosa significa???