View Single Post
Old 19-06-2008, 07:33   #9 (permalink)
pesokow
How do I mine for fish?!
 
pesokow's Avatar
 
Join Date: May 2008
Posts: 6
Well, the registration page you gave me work fine but it keeps opening the login page even if I login correctly! (The code that LukeV gave) Here is the login page you gave;

PHP Code:
<?php include 'db.php';
if (!isset(
$_SESSION['user_id'])) {?> 
    <form action="login.php" method="post" id="login">    
    <div> 
    <label>Username: </label><input type="text" name="username" value="<?php if (isset($_SESSION['failed_username'])) echo $_SESSION['failed_username']; ?>"/>        
    <label>Password: </label><input type="password" name="password" />       
    <input type="submit" name="login" value="Login" />
    </div>      
    </form>         
    <a class="links" href="register.php">Register</a>      
  <?php }else{           
    echo 
"<span>Welcome <a href=\"#\">{$_SESSION['user_name']}!</a></span>"?>
    <a class="links" href="logout.php">Logout</a> <?php           
              
?>

and this is the db page;

PHP Code:
<?php
$connection 
mysql_connect("localhost""***""****");
$db_select mysql_select_db("****"$connection);
session_start();
?>

Thanks again
  Reply With Quote