Please give me the solution.When i give username & password in the admin login page ot shows the errorrs!!

0 votes
asked Sep 28, 2016 in Database Design and Development (DDD) by falvee (390 points)

Notice: Undefined variable: adminUser in G:\wamp\www\shop\admin\login.php on line 5

Notice: Undefined variable: adminPass in G:\wamp\www\shop\admin\login.php on line 6

Notice: Undefined variable: adminUser in G:\wamp\www\shop\admin\login.php on line 8

Notice: Undefined variable: adminPass in G:\wamp\www\shop\admin\login.php on line 8

Notice: Trying to get property of non-object in G:\wamp\www\shop\classes\Adminlogin.php on line 19

Notice: Trying to get property of non-object in G:\wamp\www\shop\classes\Adminlogin.php on line 19

Fatal error: Call to a member function validation() on a non-object in G:\wamp\www\shop\classes\Adminlogin.php on line 19

login.php

<?php include '../classes/Adminlogin.php';?>
<?php
$al = new Adminlogin();
if ($SERVER['REQUESTMETHOD'] == 'POST'){
$adminUser == $POST['adminUser'];
$adminPass == md5($
POST['adminPass']);

    $loginChk = $al->adminLogin($adminUser,$adminPass);
}

?>
<!DOCTYPE html>


Admin Login






Admin Login



<?php if(isset($loginChk)){ echo $loginChk; } ?>










<!-- form -->
<!-- button -->
<!-- content -->
<!-- container -->

Adminlogin.php

<?php include '../lib/Session.php'; Session::checkLogin(); include_once '../lib/Database.php'; include_once '../helpers/Format.php'; ?>

<?php
class Adminlogin{

private $db;
private $fm;
public function __construct(){
    $this->db = new Database();
    $this->fm = new Format();
}

public function adminLogin($adminUser,$adminPass){
    $adminUser->$this->fm->validation($adminUser);
    $adminPass->$this->fm->validation($adminPass);

    $adminUser=mysqli_real_escape_string($this->db->link,$adminUser);
    $adminPass=mysqli_real_escape_string($this->db->link,$adminPass);

    if(empty($adminUser) || empty($adminPass)){
        $loginmsg = "Username or Password must not be empty !!!";
        return $loginmsg;
    }else{
        $query = "SELECT * FROM tbl_admin WHERE adminUser='$adminUser' AND adminPass='$adminPass'";
        $result = $this->db->select($query);
            if($result != false){
                $value = $result->fetch_assoc(); 
                Session::set("adminLogin",true);
                Session::set("adminId",$value['adminId']);
                Session::set("adminUser",$value['adminUser']);
                Session::set("adminName",$value['adminName']);
                header("Location:dashboard.php");

            }else{
                $loginmsg = "Username and Password not match !!!";
                return $loginmsg;

        }
}

}
}
?>

1 Answer

0 votes
answered Dec 22, 2016 by rakesh_mistry (460 points)

Please Follow up login.php

$al = new Adminlogin();
if ($_SERVER['REQUESTMETHOD'] == 'POST'){
$adminUser = $_POST['adminUser'];
$adminPass = md5($_POST['adminPass']);

    $loginChk = $al->adminLogin($adminUser,$adminPass);
}

Also Follow up Adminlogin.php

$adminUser = $this->fm->validation($adminUser);
$adminPass = $this->fm->validation($adminPass);

722 questions

656 answers

179 comments

4,717 users

Welcome to IDB Scholars Forum, where you can ask questions and receive answers from other members of the community. It's 100% free.
আইডিবি স্কলারস ফোরামে আপনাকে স্বাগত - প্রোগ্রামিং, ডিজাইন, ডেভেলপমেন্ট, ব্লগিং, ইন্টারনেটসহ তথ্য প্রযুক্তির যাবতীয় বিষয় নিয়ে আলোচনার একটি মুক্ত মঞ্চ হলো এই ফোরাম । এখানে আইসিটি বিষয়ক আপনার প্রশ্ন, উত্তর এবং অভিজ্ঞতা শেয়ার করুন, আলোচনা করুন এবং সমাধান নিন। দেশের তরুণ প্রজন্মকে আইসিটিতে আগ্রহী করাই আমাদের মূল লক্ষ্য।
** ইংলিশ বা বাংলা যে কোনো ভাষায় আপনি এই ফোরামে আলোচনা করতে পারবেন। তবে বাংলাকে ইংরেজি অক্ষরে লিখবেন না।
  1. tulbadex

    110 points

    0 answers

  2. mealbulb9

    100 points

    0 answers

  3. seat1temper

    100 points

    0 answers

  4. roll0fender

    100 points

    0 answers

  5. KeiraX382741

    100 points

    0 answers

...