Welcome Guest, Not a member yet? Register   Sign In
Always inside frame
#1
Wink 
(This post was last modified: 06-14-2023, 09:01 PM by keithhui.)

I am using CI4. I make a simple view, however, it is always under a frame.
http://www.myohomall.com/login
After I login, the url is still the same. I find that all contents are under a frame. Do I set config wrongly?

Also, my url can be accessed only by incognito mode of Chrome, but it is normal in Edge. How can I fix it?
Reply
#2

Can you show the code of the view?
Reply
#3

(This post was last modified: 06-15-2023, 04:00 PM by keithhui.)

(06-15-2023, 04:00 AM)JustJohnQ Wrote: Can you show the code of the view?

<? $session = session() ?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Log In | MCKING</title>
<? require("assets/minton_head.php"); ?>
    </head>

    <body class="loading">
    <?//= session()->getFlashdata('error') ?>
    <?//= validation_list_errors() ?>
        <div class="account-pages mt-5 mb-5">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-md-8 col-lg-6 col-xl-4">
                        <div class="card border border-secondary">
<div class="card-header text-white bg-warning">
<span class="logo-lg">
                            <img class="avatar-md" src="assets/myimage/system/logo_icon.png"> MCKING V3.0
                            </span>
                        </div>
                            <div class="card-body p-4">
                                <?  if (session()->getFlashData('msg')) {
                                    echo "<div class='alert alert-warning' role='alert'><i class='mdi mdi-alert-outline me-2'></i>".session()->getFlashData('msg')."</div>";
}
        ?>
                                <form name="loginform" method="post" action="login">
                                    <div class="mb-2">
                                        <label for="emailaddress" class="form-label"><?=session('LOGINID')?></label>
                                        <input class="form-control" type="text" name="loginid" id="emailaddress" required placeholder="輸入你的用戶名稱" value="<?= set_value('loginid')?>">
                                    </div>

                                    <div class="mb-2">
                                        <label for="password" class="form-label"><?=session('PASSWORD')?></label>
                                        <div class="input-group input-group-merge">
                                            <input type="password" id="password" name="password" class="form-control" placeholder="輸入你的密碼" required value="<?= set_value('password')?>">
                                           
                                            <div class="input-group-text" data-password="false">
                                                <span class="password-eye"></span>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="mb-3">
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" id="checkbox-signin" checked name="rememberme">
                                            <label class="form-check-label" for="checkbox-signin">
                                                Remember me
                                            </label>
                                        </div>
                                    </div>

                                    <!--div class="d-grid mb-0 text-center button-list"-->
                                    <div class="row text-center w-75 m-auto">
                                    <div class="text-center">
                                        <button class="btn btn-outline-info rounded-pill btn-block col-md-5 col-lg-5 col-xl-5" type="submit">登入</button>
                                    <a href="register.php" class="btn btn-outline-warning rounded-pill btn-block col-md-5 col-lg-5 col-xl-5">註冊</a>
                                    </div>
</div>
                                </form>

                                <div class="text-center">
                                    <h5 class="mt-3 text-muted">Sign in with</h5>
                                    <ul class="social-list list-inline mt-3 mb-0">
                                        <li class="list-inline-item">
                                            <a href="javascript: void(0);" class="social-list-item border-purple text-purple"><i class="mdi mdi-facebook"></i></a>
                                        </li>
                                        <li class="list-inline-item">
                                            <a href="javascript: void(0);" class="social-list-item border-danger text-danger"><i class="mdi mdi-google"></i></a>
                                        </li>
                                        <li class="list-inline-item">
                                            <a href="javascript: void(0);" class="social-list-item border-info text-info"><i class="mdi mdi-twitter"></i></a>
                                        </li>
                                        <li class="list-inline-item">
                                            <a href="javascript: void(0);" class="social-list-item border-secondary text-secondary"><i class="mdi mdi-github"></i></a>
                                        </li>
                                    </ul>
                                </div>

                            </div> <!-- end card-body -->
                        </div>
                        <!-- end card -->

                        <div class="row mt-3">
                            <div class="col-12 text-center">
                                <p> <a href="auth-recoverpw.html" class="text-muted ms-1">忘記密碼?</a></p>
                                <p class="text-muted">沒有戶口? <a href="register.php" class="text-primary fw-medium ms-1"><?=session('REGISTER')?></a></p>
                            </div> <!-- end col -->
                        </div>
                        <!-- end row -->

                    </div> <!-- end col -->
                </div>
                <!-- end row -->
            </div>
            <!-- end container -->
        </div>
        <!-- end page -->

<? require("assets/minton_footer.php"); ?>       
    </body>
</html>

Inside Controller User.php

public function login()
{
helper('form');
$data['title'] = "Login";
$session = session();

// Check whether the form is submitted
// Normal loading the login page
if (!$this->request->is('post')) {
return view('login', $data);
}

// Check the submitted form
else {
$post = $this->request->getPost(['loginid', 'password']);
if (! $this->validateData($post, [
'loginid' => 'required|max_length[255]|min_length[5]',
'password' => 'required|max_length[5000]|min_length[8]',
])) {
$session->setFlashdata('msg', "Information is too short");
return view('login', $data);
}

$userModel = model(userModel::class);
// $logModel = model(userModel::class);
$loginid = $this->request->getVar('loginid');
$password = $this->request->getVar('password');

$validation = $userModel->where('loginid', $loginid)->first();

if ($validation) {
$pass = $validation['password'];
$auth = (md5($password) == $pass);

// Login success
if ($auth) {
// Write log
// $user->save([''])

// Set session
$session_data = [
'userid' => $validation['userid'],
'rolelevel' => $validation['rolelevel'],
'fullname' => $validation['fullname'],
'email' => $validation['email'],
'isLoggedIn' => TRUE
];
$session->set($session_data);

// Redirect to main menu page
return $this->main();

}
else {
$session->setFlashdata('msg', session('PASSWORDNOTMATCH'));
}
}
else {
$session->setFlashdata('msg', session('ALERT_LOGINFAILURE'));
}
return view('login', $data);
}
}
Reply
#4

My guess is that your hosting party is putting it in a frame. Try it with a very simple html doc and call it from your controller. If this ends up in a frame too, I would contact the hosting provider if I were you.
Reply
#5

(This post was last modified: 06-15-2023, 11:05 PM by keithhui.)

(06-15-2023, 10:30 PM)JustJohnQ Wrote: My guess is that your hosting party is putting it in a frame. Try it with a very simple html doc and call it from your controller. If this ends up in a frame too, I would contact the hosting provider if I were you.

I am using Synology NAS web station. It is normal for basic php website. But when I am newly using codeigniter, it shows strange.

Or you may access http://keithhui.myds.me/mcs/public/login for my problem. Thanks.
Reply
#6

Looks good. Solved?
Reply
#7

(06-17-2023, 04:00 AM)JanFromHamburg Wrote: Looks good. Solved?

Not yet.

Which statement is correct?

return $this->main();

return view('main');

or others?

The above staetment gets the same result -  within a frame.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB