Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [PHP] Undefinied variable
Pages (2): « 1 [2]   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Flyzone
.coltellino:svizzero.

User info:
Registered: Jan 2003
Posts: 1956 (0.23 al dì)
Location:
Corso:
Anno:
Time Online: 19 Days, 22:20:19 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by fabpicca
se metti in ogni pagina session_start() , come del resto suppongo tu stia facendo

Esatto, tralasciando la sintassi php è più o meno così:

session_start();
se $_SESSION['username']="" -->Ti devi loggare
altrimenti {
do query_sql = SELECT * FROM users WHERE username = $_SESSION['username'] AND user_level='livello root';
se (query_sql > 0_risultati) allora --> codice x pagina "root"
altrimenti --> codice x pagina "utenti normali"
}
al logout: session_destroy();

Così in ogni pagina. Può andare come logica?

13-11-2004 10:58
Click Here to See the Profile for Flyzone Click Here to See the Blog of Flyzone Click here to Send Flyzone a Private Message Find more posts by Flyzone Add Flyzone to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Flyzone
Esatto, tralasciando la sintassi php è più o meno così:

session_start();
se $_SESSION['username']="" -->Ti devi loggare
altrimenti {
do query_sql = SELECT * FROM users WHERE username = $_SESSION['username'] AND user_level='livello root';
se (query_sql > 0_risultati) allora --> codice x pagina "root"
altrimenti --> codice x pagina "utenti normali"
}
al logout: session_destroy();

Così in ogni pagina. Può andare come logica?


ad alto livello direi di si!

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

13-11-2004 12:28
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.67 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Flyzone
Non uso i cookies, e non c'è nemmeno il passaggio di parametri negli url (che, se non sbaglio, va un pò contro la sicurezza e deve utilizzare variabili globali no?), eppure il tutto funziona indi presumo che le sessioni stiano in memoria visto che richiamo i dati da $_SESSION e visto che appena chiudo il browser e lo riapro la sessione è morta.


Sbagliato :)

Tu CREDI di non usare i cookies, in realtà il server scrive l'ID della sessione in un cookie sul client, ed è attraverso tale cookie che, cambiando pagina, lo riconosce e gli riassegna le proprie variabili $_SESSION.

Nel momento in cui chiudi il browser quel cookie muore, quando lo riapri il server crea un'altra istanza con un ID diverso.

ALTERNATIVAMENTE PHP può passare l'ID negli URL.

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

13-11-2004 13:30
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
korn
SET FIRE!

User info:
Registered: Jun 2002
Posts: 5793 (0.67 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Riporto informazioni utili da www.php.net [ http://it.php.net/manual/en/ref.session.php ]



A visitor accessing your web site is assigned an unique id, the so-called session id. This is either stored in a cookie on the user side or is propagated in the URL.


Ma questo l'avevo già detto........ l'importante è ciò che segue


The session module cannot guarantee that the information you store in a session is only viewed by the user who created the session. You need to take additional measures to actively protect the integrity of the session, depending on the value associated with it.


Come dicevi tu Fly, effettivamente qualcuno può editare il cookie e fare un session hijacking, solo che le possibilità che questo avvenga sono veramente molto risicate, poiché

- dovrebbe cogliere il momento esatto in cui un admin ha una sessione aperta
- dovrebbe in qualche modo recuperare il suo Session ID..... sgamare uno username è molto facile, un numero casuale un po' meno

That's all, folks :)

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.

13-11-2004 13:38
Click Here to See the Profile for korn Click Here to See the Blog of korn Click here to Send korn a Private Message Visit korn's homepage! Find more posts by korn Add korn to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flyzone
.coltellino:svizzero.

User info:
Registered: Jan 2003
Posts: 1956 (0.23 al dì)
Location:
Corso:
Anno:
Time Online: 19 Days, 22:20:19 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by korn
Tu CREDI di non usare i cookies, in realtà il server scrive l'ID della sessione in un cookie sul client, ed è attraverso tale cookie che, cambiando pagina, lo riconosce e gli riassegna le proprie variabili $_SESSION.

Ok, abbiamo trovato il punto che mi crea confusione :asd:
Tu dici che salva in un cookie sul CLIENT.
Allora mi spieghi perchè non trovo un dannato cookie?
Mi spiego: ho cancellato i cookies e cache dal client, mi sono loggato, ritorno nella cartella cookies e non trovo nulla.
Da qui a pensare che siano in memoria il passo è breve...o forse è perchè server e client stanno sulla stessa macchina (la mia)? :pensa:

13-11-2004 15:07
Click Here to See the Profile for Flyzone Click Here to See the Blog of Flyzone Click here to Send Flyzone a Private Message Find more posts by Flyzone Add Flyzone to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
unidavide
.arcimaestro.

User info:
Registered: Nov 2002
Posts: 373 (0.04 al dì)
Location:
Corso:
Anno:
Time Online: 11 Days, 19:48:07: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Flyzone
Da qui a pensare che siano in memoria il passo è breve

esatto, il browser lo tiene in memoria

13-11-2004 16:21
Click Here to See the Profile for unidavide Click here to Send unidavide a Private Message Find more posts by unidavide Add unidavide to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 05:01.    Post New Thread    Post A Reply
Pages (2): « 1 [2]   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.098 seconds (65.32% PHP - 34.68% MySQL) con 23 query.