eyexro Posted January 7, 2012 Report Posted January 7, 2012 Ma poate ajuta cineva cu un cod html pentru login pe o pagina ?Vreau sa limitez acces doar pentru unele conturi.. si caut ceva simplu php [ e un site html ] Quote
Robert1995 Posted January 7, 2012 Report Posted January 7, 2012 hai ca is mahmur dar o porcarie de asta pot face ai PM Quote
eyexro Posted January 7, 2012 Author Report Posted January 7, 2012 robert vad ca nu raspunde si eu am nevoie urgent.. vreau doar un cont care sa-mi ascunda contetul cerand un username si o parola Quote
pr00f Posted January 7, 2012 Report Posted January 7, 2012 Password protect a page - Totally PHPPHP Login script tutorialCaut? de acum pe google. 1 Quote
maftrunk Posted January 7, 2012 Report Posted January 7, 2012 Nu prea imi vine sa cred ca nu ai gasit dupa 2-3 cautari in google sau scaneaza si tu in cel mai rau caz un login.php...... Quote
aelius Posted January 7, 2012 Report Posted January 7, 2012 (edited) Pune htaccess+htpasswd, daca iti trebuie ceva extrem de simplu, nu are rost sa te complici. Sigur, nativ, etc..Exemplu# .htaccess fileAuthType BasicAuthName "For Members Only"AuthUserFile /calea/catre/documentroot/.htpasswdrequire valid-user# .htpasswd fileeyexro:L2stq4/UoNota: .htpasswd il generezi din linia de comanda cu htpasswd sau poti folosi un tool online.Asta e tot. Edited January 7, 2012 by aelius 1 Quote
eyexro Posted January 7, 2012 Author Report Posted January 7, 2012 ce am gasit e cu baze de date si ma depaseste momentan.. insa e un tutorial intreg si de acolo incepmultumesc celor care m-ati ajuta! in special pr00f Quote
Silviu Posted January 7, 2012 Report Posted January 7, 2012 Din asta sigur vei intelege: Script inregistrare - autentificare, logare E chiar mura in gura. Quote
Moderators Dragos Posted January 8, 2012 Moderators Report Posted January 8, 2012 (edited) @gecko: Nu ai ce sa faci cu sesiunile si nici de ce sa criptezi parola.<?php$adminpass = "secretpass123";$adminname = 'admin';if ($_POST['pword'] == $adminpass && $_POST['uname'] == $adminname) {?><!-- codul html pentru pagina aici --><?php } else { ?><form action="" method="POST"><input type="text" name="uname" /><input type="password" name ="pword" /><input type="submit" value="Login" /></form><?php } ?> Edited January 9, 2012 by Dragos Quote
Moderators Dragos Posted January 9, 2012 Moderators Report Posted January 9, 2012 (edited) Am criptat-o în caz c? cineva preia scriptul prin alte metode, totusi s? nu fie clar?... ?i sesiunea este pentru perioada de login, dac? el intr? pe pagin? f?r? sesiune va avea acces doar o dat?, apoi când intra iar ii cere datele de login. Sesiunea l-ar ?ine minte mai mult timp.Daca vrei sa ramana mai mult timp, pui cookie<?php$adminpass = "secretpass123";$adminname = 'admin';$h = md5($adminname . $adminpass . "sh");if ($_POST['pword'] == $adminpass && $_POST['uname'] == $adminname)setcookie("user",$h,time()+3600);if($_GET['p']=="delogare")setcookie("user","",time()-3600);if($_COOKIE['user']==$h){?><a href="?p=delogare">Delogare</a><!-- codul html pentru pagina aici --><?php } else { ?><form action="" method="POST"><input type="text" name="uname" /><input type="password" name ="pword" /><input type="submit" value="Login" /></form><?php } ?> Edited January 9, 2012 by Dragos Quote