Fatal error: Call to a member function AddUser() on a non-object
<p>so after hours on the web searching for smallest details or solution for this error I still can't fix it</p>

<p><strong>The errors :</strong></p>

<pre><code>Notice: Undefined variable: Login in C:\xampp\htdocs\up\administration\adduser.php on line 3

Fatal error: Call to a member function AddUser() on a non-object in C:\xampp\htdocs\up\administration\adduser.php on line 3
</code></pre>

<p><strong>These errors are from adduser.php which contains</strong></p>

<pre><code>&lt;?php
require_once('LoginClass.php');
$Login-&gt;AddUser('Test','test312');
?&gt;
</code></pre>

<p><strong>And this is the LoginClass.php</strong></p>

<pre><code>&lt;?php

class Login {

//Username Variables
private $username;
private $password;

//MySQL Variables
private $Host;
private $MySQLUsername;
private $MySQLPassword;
private $Database;
private $Conn;


//Constructor
public function Login()
{
    session_start();
    $this-&gt;Host = "localhost";
    $this-&gt;MySQLUsername = "root";
    $this-&gt;MySQLPassword = "";
    $this-&gt;Database = "up";

    $this-&gt;Connection();

    unset($this-&gt;Host);
    unset($this-&gt;MySQLUsername);
    unset($this-&gt;MySQLPassword);
    unset($this-&gt;Database);
}
//**********************
//Mysql Functions
//********************** 
public function Connection()
{
    $this-&gt;Conn = @mysql_connect($this-&gt;Host,$this-&gt;MySQLUsername,$this-&gt;MySQLPassword);

    if($this-&gt;Conn)
    {
        mysql_select_db($this-&gt;Database) OR die('Could not select DB');
    }
    else
    {
        die(mysql_error());
    }  
}

public function Query($sql)
{
    $result = mysql_query($sql);

    if(!$result)
    {
        die(mysql_error());
    }

    return $result;
}

public function Disconnect()
{
    mysql_close($this-&gt;Conn);
}

//Escapes bad values for MySQL to prevent SQL injections.
public function EscapeString($badstring)
{
    if(!get_magic_quotes_gpc())
    {
        $goodstring = addslashes($badstring);
    }
    else
    {
        $goodstring = stripslashes($badstring);
    }

    $goodstring = mysql_real_escape_string($badstring);

    return $goodstring;
}

public function EncryptPassword($password)
{
  return sha1(md5($password));  
} 
//Check if the user can login
public function CheckLogin($username,$password)
{
    $this-&gt;username = $this-&gt;EscapeString($username); 
    $this-&gt;password = $this-&gt;EscapeString($this-&gt;EncryptPassword(($password)));

    $result = $this-&gt;Query("SELECT * FROM `users` WHERE `username` = '$this-&gt;username' AND `password` = '$this-&gt;password' LIMIT 1");

    //If we get one result we know the login is right.
    if(mysql_num_rows($result) == 1)
    {
        $this-&gt;username = $username;
        $_SESSION['username'] = $this-&gt;username;
        $_SESSION['authorized'] = 1; 

        header('location:Private.php');
    }
    else 
    {
        die('Invalid Login');
    }

}
//Add a user
public function AddUser($username,$password)
{
    //$username = $this-&gt;EscapeString($username);
    //$password = $this-&gt;EscapeString($this-&gt;EncryptPassword($password));
    $username = $this-&gt;$username;
    $password = $this-&gt;$this-&gt;EncryptPassword($password);

    $result = $this-&gt;Query("INSERT INTO `users` (username,password) VALUES ('$username','$password')");
}
//Takes the result of a query and puts the information into an array
public function Result_To_Array($result)
{
    $result_array = array();

    for ($i=0; $row = mysql_fetch_array($result); $i++) 
    {
        $result_array[$i] = $row;
    }

    return $result_array;

}
//Delete user
public function DeleteUser($username)
{
    $username = $this-&gt;EscapeString($username);

    $result = $this-&gt;Query("DELETE FROM `users` WHERE `username` = '$username' LIMIT 1");

}
//Checks if the user is authorized or not
public function IsAuth()
{
    if(isset($_SESSION['username']) &amp;&amp; $_SESSION['authorized'] == 1)
    return true;

    else
    {
        die('You are not authorized to view this information');
        header('login.html');
    }    
}
//Shows user's IP
public function GetIP()
{
    return $_SERVER['REMOTE_ADDR'];
}
//Display all users
public function ShowUsers()
{
    $users = $this-&gt;Result_To_Array($this-&gt;Query("SELECT * FROM `users`"));

    foreach($users as $user)
    {
        echo $user['username']."&lt;br /&gt;";
    } 
}

public function LogOut()
{

     session_destroy();

     header('location:login.html');
}
}
?&gt;
</code></pre>
