Guest User

Untitled

a guest
Sep 9th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <?php
  2. include 'sadrzaj.php';
  3. session_start();
  4. // Check if he wants to login:
  5. if (!empty($_POST[username]))
  6. {
  7. require_once("connect.php");
  8.  
  9. // Check if he has the right info.
  10. $query = mysql_query("SELECT * FROM members
  11. WHERE username = '$_POST[username]'
  12. AND password = '$_POST[password]'")
  13. or die ("Error - Ne mogu ce je ulogovati se na ovaj profil!.");
  14.  
  15. $row = mysql_fetch_array($query)
  16. or die ("Error - Couldn't login user.");
  17.  
  18. if (!empty($row[username])) // he got it.
  19.  
  20. {
  21. $_SESSION[username] = $row[username];
  22. echo "<div class='timeline'><img src='$_POST[slika]'><br>Cao $_POST[username]! Uspesno si ulogovan.<a href='logout.php'><p align'right'>Odjavi se</p></a><br></div> ";
  23. echo"<div class='album
  24. '><a href='picture.php'><i>Album</i></a></div>";
  25. exit();
  26. }
  27. else // bad info.
  28. {
  29. echo "Error - Couldn't login user.<br /><br />
  30. Please try again.";
  31. exit();
  32. }
  33. }
  34.  
  35. ?>
  36.  
  37. <html>
  38. <head>
  39. <link rel="stylesheet" href="stil.css" type="text/css" />
  40. <a><img src="head.png"></a>
  41. <title>Uloguj se</title>
  42. </head>
  43. <body>
  44. <div class='login2'><form action="login.php" method="post">
  45. <table width="75%" " align="center" cellpadding="3" cellspacing="1">
  46. <tr>
  47. <td width="100%"><h5>Uloguj se</h5></td>
  48. </tr>
  49. <tr>
  50. <td width="100%"><label>Korisnicko ime: <input type="text" name="username" size="25" value="<? echo $_POST[username]; ?>"></label></td>
  51. </tr>
  52. <tr>
  53. <td width="100%"><label>Sifra: <input type="password" name="password" size="25" value=""></label></td>
  54. </tr>
  55. <tr>
  56. <td width="100%"><input type="submit" value="Uloguj se!"></td>
  57. </tr>
  58. <tr>
  59. <td width="100%"><a href="register.php">Registruj se!</td>
  60. </tr>
  61. </table>
  62. </form>
  63. </div>
  64. </body>
  65. </html>
Add Comment
Please, Sign In to add comment