dongzhihong3940 2019-06-02 21:29
浏览 40

在我的bootstrap网站上,alertbox返回我的整个网络文件

Basically, on my website, I was trying to create a login system and I did it and everything's fine until my alert box from bootstrap4 started returning my web file after logging in - return of my web file from the alert box: https://gyazo.com/aa21b2f0ae4d427348c0e35495de0c2e, and the actual web file: https://gyazo.com/29c4768bf0206feb667b9ab438f626bc

Sorry for not posting it in the image block but i needed to have at least 10 reputation points in order to do that and without them it will be hard to understand

I've tried undoing my actions but it still didn't help and the problem persists

I get 2 PHP notices:

PHP Notice:  session_start(): A session had already been started - ignoring in (path)/action.php on line 46, referer: https://website.com/index.php
PHP Notice:  Undefined index: username in (path)/session.php on line 6, referer: https://website.com/index.php

And the code that it refers to: Action.php

if (isset($_POST['action']) && $_POST['action'] == 'login') {
   session_start(); // line 46 in action.php

   $username = $_POST['username'];
   $password = $_POST['password'];

Session.php

session_start();
require 'includes/config.php';

$user = $_SESSION['username']; // line 6 in session.php
$stmt = $connection->prepare("SELECT username, activetill FROM users WHERE username = ?");
$stmt->bind_param("s", $user);
$stmt->execute();

And the actual code that makes the alert box return something:

$("#login").click(function(e) {
    if (document.getElementById('login-form').checkValidity()) {
        e.preventDefault();
        $("#loader").show();
        $.ajax({
            url: 'action.php',
            method: 'post',
            data: $("#login-form").serialize() + '&action=login',
            success: function(response) {
                if (response === "You\'ve been successfully logged in.") {
                    window.location = 'panel.php';
                } else {
                    $("#alert").show();
                    $("#result").html(response);
                    $("#loader").hide();
                }
            }
        });
    }
    return true;
});
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题