Jump to content
php.lv forumi

session login script


FT3

Recommended Posts

Labdien te tada lieta , vjg dabut php login scriptu kurš strada uz sessiam

piemers :

 

Login : input laucinš
Passsword : input laucinš

 

ja tu esi veiksmigi ielogojies

 

ņem informaciju no mysql datubazes

 

un rada profila informaciju !

 

p.s. mekleju foruma nek0 tadu neatrdau ;/

 

ļoti ļoti vjg šo scriptu , iepriekš paldies ;)

Edited by FT3
Link to comment
Share on other sites

pie login formās kad viss ir ok uzliec

 

$_SESSION["useris"] = $pieskiram_kkadu_mainigo_piemeram_id

faila sākumā

session_start(); ( šito vajag visos failos )

 

tālāk piem jaunsfails.php

 

session_start();

if(isset($_SESSION["useris"]))

{

rādam lapu un velkam spiežam stumjam

}

else

{

nogalinam un slēpjam pierādījumus

}

Link to comment
Share on other sites

woow vēl nesen tieši šito mācīju eT`, un tgd jau viņš pats māca tālāk. forši! super!!! :))

 

btw, ierakstīju googlē "php login" un tajos rezultātos ir arī skripti ar aprakstiem, kas visu paskaidro (vismaz cenšas izskaidrot :D)

Edited by 2easy
Link to comment
Share on other sites


<form action="" method="post">
Vards:<input type=text name=nicks>
Parole: <input type="password" name=parole>
<input type=submit value=Ielogoties name=login>

  <?
if ($login){

   $con=mysql_connect('localhost','xxx','xxxx');
   mysql_selectdb('test',$con);
   $logins=$_POST['nicks'];
   $pswd=$_POST['parole'];
   $q="select * from login WHERE nickname='$logins' and passwd='$pswd'" or die (mysql_error());
   $data=mysql_query($q);
       $showdata=mysql_fetch_assoc($data);

   if($pswd==$showdata["passwd"] && $logins==$showdata["nickname"]){
       session_start();
   $_SESSION["username"]=$logins;
  	echo "esam ielogojusies";

  }
  else echo "Ielogosanas nav izdevusies";
}   

 

attiecigi ja gribam hasotas paroles tad mazliet japamaina kodins dazas vietas japievienot md5() un attiecigi ari datubaze ievietojot paroli vajag nohashot

 

P.S. Ka izlogoties no sesijam cerams zinasi :)

Edited by bobsters
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...