Jump to content

Need help please


ch1326

Recommended Posts

Can't figure it out what error is. need help ASAP

 

 


<?php
    session_start();
    include ("forum.inc");

    $links = "<a href = 'main.php'>Click here to proceed to the main page</a><br /><br /><a href = 'enter.php'>Click here to log out.</a>";
   
    if ($user && $pass){
        if ($logged_in_user = $user){
            setup_page("Already logged in", "Whoops");
      l     echo "{$user}, You are already logged in. <BR /><BR />";
            echo $links;
            exit;
        }
        doConnect()
        $result = mysql_query("SELECT * FROM user where name = '{$user}' AND password = {$pass} ");
        if (!$result){
            fail("database query failed, login page", true);
        }
        if (mysql_num_rows($result)>0){
            $record = mysql_fetch_assoc($result);
            $logged_userID = $record["userID"];
            $_SESSION["logged_userID"];
            $logged_in_user = $user;
            $_SESSION["logged_in_user"];
            if ($record["mod"]){
                $logged_as_mod = true;
                $_SESSION["logged_as_mod"];
            }
            setup_page("Welcome","Welcome");
            echo $links;
            exit;
        }else {
            setup_page("Invalid","Invalid login");
            echo "That username-password combination does not appear to match our records. Pleas try again. <BR/><BR/>";
        }
        elseif($user || $pass){
            setup_page("Invalid","Invalid login");
            echo "Please fill in both fields.<BR/><BR/>";
        }
        else{
            setup_page("Login","Login");
            echo "Please enter your detail to log in";
        }
    }
    
?>
<form method = 'POST' ACTION = 'login.php'>
Your username: <input type = 'text' name = 'user' MAXLENGTH = '20' SIZE = '10'><BR>
Your password: <input type = 'password'  name = 'password' MAXLENGTH = '10' SIZE = '10'><BR>
<input type = 'submit' value = 'Login'>
</form>
</body>

</html>

 

 

Cheers

 

 

Link to comment
Share on other sites

do you get a white screen?

 

I would start by fixing these 2 errors

 


   if ($user && $pass){
        if ($logged_in_user = $user){
            setup_page("Already logged in", "Whoops");
          echo "{$user}, You are already logged in. <BR /><BR />";
            echo $links;
            exit;
        }
        doConnect();

 

Link to comment
Share on other sites

include("forum.inc"); //isnt there a .php at the end of that

$result = mysql_query("SELECT * FROM user where name='{$user}' AND password='{$pass}' "); //missing a set of '

Theres also a random l in there.

elseif($user || $pass){
            setup_page("Invalid","Invalid login");
            echo "Please fill in both fields.<BR/><BR/>";
        }
[/php

Should that be this?
[code=php:0]
elseif(!$user || !$pass){
            setup_page("Invalid","Invalid login");
            echo "Please fill in both fields.<BR/><BR/>";
        }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.