Jump to content
php.lv forumi

Login skripts ar Sessijam


Snaip3Rs

Recommended Posts

Te es biju atradis nelielu login system skriptu!

 

Tabulas kas jaievieto datubāzē!

Links te

 

Piekonektoties pie datubāzes!

base.php

 

Login forma!

login.php

 

Registrēšanas forma!

register.php

 

Izlogošanās funkcija!

logout.php

 

Profila lapa!

index.php

 

Būšu pateicīgs ja jūs pielabotu profila lapu! Lai uzrādītu pēdējo login reizi u.t.t. Ja varat. Ja nē tad nekas.

Piemēram izveidot datubāzē vēlvienu row ar img un kad cilvēks registrējās ieliek bildes urlu un pec tam viņa profila lapā bilde rādās ar viņa username kopa!

Edited by Snaip3Rs
Link to comment
Share on other sites

<?php
if(isset($_POST['add'])){
mysql_query("UPDATE lietotaji SET img = '".$_POST['img']."' WHERE id = '".$_SESSION['id']."'");
}
?>
<form method="post">
img: <input name="img" type="text"><br/>
<input name="add" type="submit">
</form>

un pie profila

<?php
$a = mysql_fetch_assoc(mysql_query("SELECT * FROM lietotaji WHERE id = '".$_SESSION['id']."'"));
if(!empty($a['img'])){
echo "<img src='".$a['img']."'>".$_SESSION['username']."";
}else{
echo $_SESSION['username'];
}
?>

Edited by chizijs
Link to comment
Share on other sites

Gribi lai maksāju? Gaidi kad beigsies krīze! :D

 

Labi tagad gan bez jokiem gribi palīdzi negribi. Nespamo lieki!

 

 

Liels paldies Čizijam! :)

Jāmācās no paraugiem. Nevis pats uz dūlo kaut ko likt.

Edited by Snaip3Rs
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...