SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Login in a forum

    Im having trouble creating a login for a forum im working on. Nothing happens when I click on the login button. Below is the code I have used. Btw Im very new in php, i have just started learning it...
    PHP Code:
    $user_id = $_GET['users']; ?>

    <?php
    if(isset($_POST['brugernavn'])){
        
    $brugernavn $_POST['brugernavn'];
        
    $password $_POST['password'];
        
        
    $sqlBruger "SELECT * FROM users WHERE user_name = '$brugernavn' AND user_pswd = '$password'";
        
        
    $getBruger mysql_query($sqlBruger) or die (mysql_error());
        
        
    $bruger mysql_fetch_assoc($getBruger);
        
        if(
    mysql_num_rows($getBruger)== 1){
            
    $bruger_role $bruger['fk_role_id'];
            
            
    $_SESSION['functions'] = array ();
            
            
    $sql "SELECT * 
                    FROM functions
                    INNER JOIN roles
                    ON roles.role_id = role_functions.fk_role_id    
                    INNER JOIN role_functions
                    ON role_functions.fk_func_id = functions.function_id    
                    INNER JOIN users
                    ON users.fk_role_id = roles.role_id
                    WHERE users.user_id = '
    $user_id
                    GROUP BY functions.function_id
                     "
    ;
                     
            
    $result mysql_query($sql) or die (mysql_error());
            while(
    $row mysql_fetch_assoc($result)){
                
    $_SESSION['functions'][] = $row['function_id'];
                }
            
    $_SESSION['logInd'] = true;
            
            
    header("location:permissions.php");
            }
            else
            {
                echo 
    '<p>FORKERT LOGIN!...<br />
                Brugernavn er password er ikke rigtigt udfyldt!...</p><br /><br />'
    ;
                echo 
    'PrÝv igen:';
                
                echo 
    '<a href="index.php?">Tilbage til Forside</a>';
            }
        }
    ?>
    Last edited by cpradio; Feb 13, 2013 at 07:23. Reason: Added [php] tags

  2. #2
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try removing $user_id = $_GET['users']; at the top of your page. If that doesn't work, please post your form

    Regards
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for the late rply and thanx for taking your time to help. I had trouble logging in... Anyway, I decided to start afresh (building a forum)...hopefully I will figure it out Thanx again


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •