我有来自 Sendy 的这段代码,它适用于模态,我添加了引导程序和样式,现在它坏了

I have this code from Sendy that worked with modal, I added bootstrap and styling now its broken

提问人:Heather DeMontigny 提问时间:11/3/2023 最后编辑:Heather DeMontigny 更新时间:11/3/2023 访问量:33

问:

<?php include('includes/header.php');?>
<?php 
    //Redirection
    if(isset($_GET['redirect'])) 
    {
        $redirect_array = explode('redirect=', $_SERVER['REQUEST_URI']);
        $redirect = $redirect_array[1];
    }
    else $redirect = '';
    
    //Check error
    $error = isset($_GET['e']) ? $_GET['e'] : '';
    $info = isset($_GET['i']) ? $_GET['i'] : '';
    
    unlog_session();
?>

<!DOCTYPE html>
<html>
<head>
    <title>twTrendz Login</title>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/boot[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="css/loginstyles.css">
</head>

<style type="text/css">
    #wrapper 
    {       
        height: 70px;   
        margin: -150px 0 0 -130px;
        position: absolute;
        top: 50%;
        left: 50%;
    }
    h1  {
    font-size:50px;
    text-align: center;
    padding-top: 30px;
    padding-bottom:50px;
    }    
    margin {    
        margin-top: -10px;
    }
    #forgot-form {
        width:262px;
        height: 158px;
        left:59%;
        overflow: hidden;
    }
    .session_error{
        width: 220px;
    }
    .h-100 {
  padding-top: 30px;
}
</style>
<body>
    <center><h1>COMING SOON</h1></center>
    
        <div class="d-flex justify-content-center h-100">
            <div class="user_card">
                <div class="d-flex justify-content-center">
                    <div class="brand_logo_container">
                        <img src="img/logo.png" class="brand_logo" alt="twTrendz logo">
                    </div>
                </div>
            <div class="d-flex justify-content-center form_container">
                <form class="" method="post" action="<?php echo get_app_info('path')?>/includes/login/main.php">
                    <center><h2>Welcome Back!</h2>
                    <p>Login to access your account.</p></center>
                    <div class="input-group mb-2">
                        <div class="input-group-append">
                            <span class="input-group-text"><i class="fas fa-user"></i></span>                   
                        </div>
                        <input type="email" class="input" name="email" id="email" class="form-control input_user" required>
                    </div>
                    <div class="input-group mb-2">
                        <div class="input-group-append">
                            <span class="input-group-text"><i class="fas fa-key"></i></span>                    
                        </div>
                        <input type="password" class="input" name="password" id="password" class="form-control input_pass" required>
                    </div>
                    <div class="form-group">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" name="rememberme" class="custom-control-input" id="customControlInline">
                            <label class="custom-control-label" for="customControlInline">Remember me</label>
                        </div>
                    </div>
            </div>
            <div class="d-flex justify-content-center mt-3 login_container">
                <input type="hidden" name="redirect" value="<?php echo htmlentities($redirect, ENT_QUOTES);?>"/>
                <button type="submit" class="btn" id="login" class="btn login_btn">Login</button> 
            </div>

            <div class="mt-4">
                <div class="d-flex justify-content-center links">
                    Don't have an account? <a href="registration.php" class="ml-2">Sign Up</a>
                </div>
                
                <!---------Password Recovery----------->
                
                <div class="d-flex justify-content-center links">
                    <p><a href="#forgot-form" title="" data-toggle="modal" class="recovery" id="forgot-btn"><?php echo _('Forgot password?');?></a></p>
                </div>
                
                <!---------END Password Recovery----------->
            </div>
        </div>
    </div>
</div>
</form>

<div id="forgot-form" class="modal hide fade" style="height: 175px;">
        <form class="" method="post" action="<?php echo get_app_info('path')?>/includes/login/forgot.php" id="forgot">
          <h2><span class="icon icon-meh"></span> <?php echo _('Forgot password?');?></h2><br/>
          <input type="text" class="input" placeholder="<?php echo _('Your email');?>" name="email" id="forgot-email"><br/><br/>
          <button type="submit" class="btn" id="send-pass-btn"><i class="icon icon-key"></i> <?php echo _('Send password reset email');?></button>
        </form>
        <script type="text/javascript">
            $(document).ready(function() {
                $("#email").focus();
                $("#forgot-btn").click(function(){
                    $("#forgot-email").val($("#email").val());
                });
                $("#forgot").submit(function(e){
                    e.preventDefault(); 
                    
                    $("#send-pass-btn").html("<i class=\"icon icon-envelope\"></i> <?php echo _('Sending');?>..");
                    
                    var $form = $(this),
                    email = $form.find('input[name="email"]').val(),
                    url = $form.attr('action');
                    
                    $.post(url, { email: email },
                      function(data) {
                          if(data)
                          {
                            $("#send-pass-btn").html("<i class=\"icon icon-key\"></i> <?php echo _('Send password reset email');?>");
                            
                            if(data=='<?php echo _('Email does not exist.');?>')
                                alert('<?php echo _('Email does not exist.');?>');
                            else 
                            {
                                $('#forgot-form').modal('hide');
                                $('#password-sent').modal('show');
                                
                                if(data=='main_user')
                                    $("#additional-line").show();
                                else 
                                    $("#additional-line").hide();
                            }
                          }
                          else
                          {
                            alert("<?php echo _('Sorry, unable to reset password. Please try again later!');?>");
                          }
                      }
                    );
                });
            });
        </script>
    </div>
    
    <div id="password-sent" class="modal hide fade">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h3><span class="icon icon-envelope"></span> <?php echo _('Password reset email has been sent to you');?></h3>
    </div>
    <div class="modal-body">
        <p>A password reset email has been sent to you. Please check your inbox as well as your spam folder for the email. 
            <br/><br/> 
            <span id="additional-line">If you don't receive the password reset confirmation email, please <a href="https://sendy.co/troubleshooting#forgot-password" style="text-decoration: underline;">see this troubleshooting tip</a>.</span>
        </p>
    </div>
    <div class="modal-footer">
      <a href="#" class="btn btn-inverse" data-dismiss="modal"><i class="icon icon-ok-sign" style="margin-top: 5px;"></i> <?php echo _('Close');?></a>
    </div>
    </div>
</div>

</body>
</html>

即将推出

/includes/login/main.php“>

欢迎回来!

登录以访问您的帐户。

记住我 "/> 登录 /includes/login/forgot.php“ id=”forgot“> ” name=“email” id=“forgot-email
”>

$(文档).ready(function() { $(“#email”).焦点(); $(“#forgot-btn”).click(function(){ $(“#forgot-email”).val($(“#email”).val()); }); $(“#forgot”).submit(函数(e){ e.preventDefault(); $(“#send-pass-btn”).html(“ ..”); var $form = $(this), 电子邮件 = $form.find('input[name=“email”]').val(), url = $form.attr('操作'); $.post(url, { email: 电子邮件 }, 函数(数据){ if(数据) { $(“#send-pass-btn”).html(“ ”); if(数据=='') 警报(''); 还 { $('#forgot-form').modal('隐藏'); $('#password-sent').modal('显示'); if(数据=='main_user') $(“#additional 行”).show(); 还 $(“#additional 行”).hide(); } } 还 { 警报(“”); } } ); }); }); ×
        <div class="mt-4">
            <div class="d-flex justify-content-center links">
                Don't have an account? <a href="registration.php" class="ml-2">Sign Up</a>
            </div>
            
            <!---------Password Recovery----------->
            
            <div class="d-flex justify-content-center links">
                <p><a href="#forgot-form" title="" data-toggle="modal" class="recovery" id="forgot-btn"><?php echo _('Forgot password?');?></a></p>
            </div>
            
            <!---------END Password Recovery----------->
        </div>
    </div>
</div>

密码重置电子邮件已发送给您。请检查您的收件箱以及垃圾邮件文件夹中是否有电子邮件。

如果您没有收到密码重置确认电子邮件,请参阅此故障排除提示。

`

尝试重做模态,但如果我只是删除引导程序,我的模态可以工作,但我失去了所有的样式,有什么建议吗?


php bootstrap-modal sendy

评论

0赞 Adi 11/3/2023
在您的代码片段中,html 中的 php 代码被渲染并解释为字符串,您需要在 html 中转义您的 php 代码,而不是将它们保留为字符串。

答: 暂无答案