Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $action = $_GET['action'];
- if (isset($_SESSION['username'])) {
- print "<script>self.location.replace('?sida=inloggad');</script>";
- } else {
- if ($action == "login") {
- if (!$_POST['username']) {
- print "<script>self.location.replace('?sida=login&action=error');</script>";
- }
- if (!$_POST['password']) {
- print "<script>self.location.replace('?sida=login&action=error');</script>";
- }
- $query = mysql_query("SELECT * FROM flower_users WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'");
- $resultat = mysql_fetch_array($query);
- if (isset($resultat['id'])) {
- $_SESSION['username'] = $resultat['username'];
- print $_SESSION['username'];
- print "<script>self.location.replace('?sida=inloggad');</script>";
- } else {
- print "<script>self.location.replace('?sida=login&action=error');</script>";
- }}
- mysql_close($conn);
- ?>
- <table border="0" cellspacing="2" cellpadding="0" class="textblack">
- <form method="post" action="index2.php?sida=login&action=login">
- <tr>
- <td>Användare:</td>
- <td><input name="username" type="text" class="textblack" size="25"></td>
- </tr>
- <tr>
- <td>Lösenord:</td>
- <td><input name="password" type="password" class="textblack" size="25"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" class="textblack" value="Logga in"></td>
- </tr>
- </form>
- </table>
- <?
- }
- ?>
- <?
- if ($action == "error") {
- print "<p class=\"error\">Ett problem uppstod, informationen du angav var fel!</p>";
- }
- if ($action == "problem") {
- print "<p class=\"error\">Ett problem uppstod, du måste vara inloggad för att se denna sida!</p>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement