![]() |
Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Tech (http://www.dsy.it/forum/forumdisplay.php?forumid=189)
-- [php] login utente (http://www.dsy.it/forum/showthread.php?threadid=23337)
mi aggiungo a questo topic per chiedere una mano a qualcuno su come fare un script php con sessioni per il login e la gestione degli utenti, che si devono autenticare con user e password. Esiste un database con tutti gli user e le relative password. Lo script deve andare a loggare l'utente e mantenere attiva la connessione anche per le altre pagine che l'utente visiterà, tramite appunto le sessioni.
Una cosa del genere...
$q = "select pass from Utenti_at where user = '$username'";
$result = mysql_query($q,$conn);
if(!$result || (mysql_numrows($result) < 1)){
return 1; //Username non valido
}
$dbarray = mysql_fetch_array($result);
$dbarray['pass'] = stripslashes($dbarray['pass']);
$password = stripslashes($password);
if($password == $dbarray['pass']){
return 0; //User e pass ok!
}
else{
return 2; //Password errata
}
__________________
¡El paraíso no es un lugar en donde se desea para ser ido, solamente una condición para vivir!
Originally posted by erdottore
mi aggiungo a questo topic per chiedere una mano a qualcuno su come fare un script php con sessioni per il login e la gestione degli utenti, che si devono autenticare con user e password. Esiste un database con tutti gli user e le relative password. Lo script deve andare a loggare l'utente e mantenere attiva la connessione anche per le altre pagine che l'utente visiterà, tramite appunto le sessioni.
Una cosa del genere...
__________________
"io non sono come gli altri Robin Hood, io non ballo coi lupi"
"ogni mattina come narciso si specchia nel ruscello retrovisore", "ci sono mille modi per chiamare dio...dio,allha,adta,arauffa,crisma..afjasf...tanto non ti risponde"
Corrado Guzzanti è il mio Dio.
Roberto Saviano eroe nazionale.
$q = "select pass from Utenti_at where user = '$username'";
__________________
» 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.
Intervento del moderatore:
per chiarezza, ho splittato il post da quello degli editor di php, visto che è un argomento a sè (ed è più visibile)

__________________
I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.
| All times are GMT. The time now is 22:45. | Show all 4 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.