Chickenz Posted April 1, 2004 Report Share Posted April 1, 2004 Tjipa vajaga vienkāršu scriptu - 2 formas username un password i submits! Vajaga lai pārbauda vai mysql datubāzē ir ieraksts un ja ir tad uztaisa sessiju un tādējādi users var klaiņot pa lapu un raxtīt visādas lietas. Vēl... Ja users nava ielogojies tad nav pieejamas (piem.) komentāru pievienošanas iespējas!!?!?!?! Kā lai to izdara! /help/ :huh: Link to comment Share on other sites More sharing options...
Gacha Posted April 1, 2004 Report Share Posted April 1, 2004 Nu par sesijaam nezinu, bet par mysql $result = mysql_query("select * from table where user='$username' and pass='$password'"); if ($row = mysql_fetch_array ($result)) { ?> bla bla bla <? }else{header("Location: citalapa.php");} ?> Nu ja nav ielogojies kaa naakas, tad izmet araa. Nu peec taa fetch_array liec kaut kaadu tur set sesion vai ko tur vajag(sesijas nesmu aizticis) Es ieguutos datus ielieku temp teiblaa ar unix time un kad tas beidzaas tad dzeshu laukaa - princips ir tas pats kas ar sesijaam - un ir droshs. Mazliet logiskas domashanas un tad gan jau buus!!!!!!!!! PS. Pizgets kaa galva rebst no taa brendija :blink: Link to comment Share on other sites More sharing options...
des Posted April 2, 2004 Report Share Posted April 2, 2004 PS. Pizgets kaa galva rebst no taa brendija Alkaans :P Link to comment Share on other sites More sharing options...
S_K Posted April 2, 2004 Report Share Posted April 2, 2004 :lol: Vismaz formu html vareeju pats uztaisiit... html forma jebkaadaa failaa kursh ir tanii pashaa folderii <form action="login.php" method="post"> <input type="text" name="name" /> <input type="password" name="password" /> </form> login.php <? session_start(); #Tad ņem Gacha kodu ieliec #shii lieta darbojas ar register_globals ON (php.ini) $_SESSION['name'] = $_POST['name']; header('Location: index.php'); ?> index.php pirms teksta liec: <? session_start(); ?> Un kur tev vajag rakstīt to komentārui paarbbaudi: <? if(!empty($_SESSION['name'])){ #komentaaru forma } ?> ceru kaut kaa esmu paliidzeejis Link to comment Share on other sites More sharing options...
Gacha Posted April 2, 2004 Report Share Posted April 2, 2004 Ja saki kad darbojas ar register ON , tad kapeec tev ir $_SESSION['name'] = $_POST['name']; nevis $_SESSION['name'] = $name; Link to comment Share on other sites More sharing options...
S_K Posted April 4, 2004 Report Share Posted April 4, 2004 labojums, es nebiju drosh vai on vai off, tad OFF tur ir domaats... Link to comment Share on other sites More sharing options...
Klez Posted April 18, 2004 Report Share Posted April 18, 2004 es personiigi taisu shitaa: if (isset($ok)){ //ja nospiez [B]login[/B] pogu $visi = mysql_query("SELECT * FROM tabila WHERE uname='".$_POST['uname']."'"); $viens = mysql_fetch_array($visi); if (($_POST['uname'] == $viens['uname']) && ($parole == $viens['passw'])){ setcookie("kookija_vaards","kookija_veertiiba",time()+180,"/","",0); echo "<script>window.location='$scriptname'</script>"; }else echo "error"; sameeraa vienkaarsh un labi straadaa. naf probleemu, ja neskaita vienu kas ir sakaraa ar linux un PHP. bet taa viss normaali Link to comment Share on other sites More sharing options...
Recommended Posts