Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_SESSION['login'])){
- if($_SESSION['login'] == '1'){
- header("location:memberpage.php");
- }
- }
- ?>
- <html>
- <LINK REL=StyleSheet HREF="stylesheet.css" TITLE="Contemporary">
- <body>
- <div id="meny"><a href="registration.php">Registrera dig</a></div>
- <div id="huvudbox">
- <?php
- /*Includes at the top */
- include 'config/config.php';
- include 'config/functions.php';
- if(isset($_GET["auth"])){
- if($_GET["auth"] != "error"){
- ?>
- <form action="checklogin.php" method="post">
- Användare: <input type="text" name="Username" />
- Lösenord: <input type="password" name="Password" />
- <input type="submit" text="login" />
- </form>
- <?php
- }
- else if($_GET["auth"] = "error"){
- echo 'Wrong password & username';
- ?>
- <form action="checklogin.php" method="post">
- Username: <input type="text" name="Username" />
- Password: <input type="password" name="Password" />
- <input type="submit" text="login" />
- </form>
- <?php
- }
- }
- else{
- ?>
- <form action="checklogin.php" method="post">
- Username: <input type="text" name="Username" /><br/>
- Password: <input type="password" name="Password" /><br/>
- <input type="submit" text="login" />
- </form>
- <?php
- }
- mysqlClose();
- ?>
- </div>
- </body>
- </html>
- // check login
- <?php
- session_start();
- /*Includes at the top */
- include 'config/config.php';
- include 'config/functions.php';
- /*
- Session
- */
- /*Variablar*/
- $user = htmlentities($_POST["Username"]);
- $pass = htmlentities($_POST["Password"]);
- $passhash = hash('whirlpool',$pass);
- $result = mysql_query("SELECT * FROM users WHERE Username='$user' AND Password='$passhash' ");
- $count=mysql_num_rows($result);
- if($count==1){
- $_SESSION['login'] = 1;
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
- $userid = $row['Id'];
- }
- $_SESSION['id'] = $userid;
- header("location:index.php");
- }
- else {
- header("location:login.php?auth=error");
- $_SESSION['login'] = 0;
- }
- ?>
- //Logout
- <?php
- /*Includes at the top */
- session_start();
- $_SESSION['login'] = '0';
- include 'config/config.php';
- include 'config/functions.php';
- ?>
- <html>
- <LINK REL=StyleSheet HREF="stylesheet.css" TITLE="Contemporary">
- <body>
- <div id="meny"><a href="memberpage.php">Hem</a> <a href="products.php">Våran Produkter</a> <a href="logout.php">Logga ut</a></div>
- <div id="huvudbox">
- Du har nu loggats ut, klicka <a href="login.php?auth=">här</a> för att fullborda önskan<br>
- <br>
- <br>
- <br>
- <?php
- ?>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment