Failed to load source. Server responds with 500












0















I try to enter password when I open website, if the password true it will redirect me to the index.php, if the pass wrong it will let me try again.
But why does it return internal error 500 ?



jquery-1.12.4.min.js:4 GET http://www.website.com/wp-content/themes/website/index.php 500 (Internal Server Error)


This is my php code (protect.php)



<?php
if( isset($_POST["password"])){
if ($_POST["password"] == "1234"){

header("Location:/wp-content/themes/website/index.php");
exit();
}
else{
echo "false";
}
}


and this is my form with ajax (home.php). I think the problem here at the bottom in ajax ? :/



<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" 
rel="stylesheet" id="bootstrap-css">
<link href="<?php echo get_template_directory_uri() .
'/css/websiteProtect.css'; ?>" rel="stylesheet">

<link href="<?php echo get_template_directory_uri() . '/css/bootstrap.min.css'; ?>" rel="stylesheet">

<!------ Include the above in your HEAD tag ---------->

<!-- All the files that are required -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<script src="<?php echo get_template_directory_uri() . '/js/vendor/jquery-1.12.4.min.js'; ?>"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<!-- Where all the magic happens -->
<!-- LOGIN FORM -->
<div class="text-center" style="padding:50px 0">
<div class="logo">Please enter password to browse site</div>
<!-- Main Form -->
<div class="login-form-1">
<form id="protect-form" name="protect-form" class="protect-form text-left" method="post">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="password">
</div>
<div class="form-group login-group-checkbox">
<input type="checkbox" id="lg_remember" name="lg_remember">
<label for="lg_remember">remember</label>
</div>
</div>
<button type="submit" class="login-button"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
<!-- end:Main Form -->
</div>
<script>
/**
* Created by Faisal_pc on 4/9/2016.
*/

$(document).ready(function() {
$('#protect-form').validate({
rules: {
password: {

required: true
},

},
highlight: function(element) {
$(element).closest('.form-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid').closest('.form-group').removeClass('error').addClass('success');
},

submitHandler: function( form ) {

$.ajax({
url : '/wp-content/themes/website/protect.php',
data : $('#protect-form').serialize(),
type: "POST",
success : function(data){
console.log(data)
}
});
return false;
}
});

});











share|improve this question




















  • 1





    If error code is 500 it's server error, what do you think?

    – Konstantin Kudelko
    Nov 22 '18 at 12:39











  • So what exactly the problem ??

    – H. Ghass
    Nov 22 '18 at 12:40











  • sorry, don't know php

    – Konstantin Kudelko
    Nov 22 '18 at 12:47











  • The page you try to redirect exists? Does not seem so.

    – pr1nc3
    Nov 22 '18 at 12:48











  • you mean the path is wrong ?

    – H. Ghass
    Nov 22 '18 at 12:49
















0















I try to enter password when I open website, if the password true it will redirect me to the index.php, if the pass wrong it will let me try again.
But why does it return internal error 500 ?



jquery-1.12.4.min.js:4 GET http://www.website.com/wp-content/themes/website/index.php 500 (Internal Server Error)


This is my php code (protect.php)



<?php
if( isset($_POST["password"])){
if ($_POST["password"] == "1234"){

header("Location:/wp-content/themes/website/index.php");
exit();
}
else{
echo "false";
}
}


and this is my form with ajax (home.php). I think the problem here at the bottom in ajax ? :/



<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" 
rel="stylesheet" id="bootstrap-css">
<link href="<?php echo get_template_directory_uri() .
'/css/websiteProtect.css'; ?>" rel="stylesheet">

<link href="<?php echo get_template_directory_uri() . '/css/bootstrap.min.css'; ?>" rel="stylesheet">

<!------ Include the above in your HEAD tag ---------->

<!-- All the files that are required -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<script src="<?php echo get_template_directory_uri() . '/js/vendor/jquery-1.12.4.min.js'; ?>"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<!-- Where all the magic happens -->
<!-- LOGIN FORM -->
<div class="text-center" style="padding:50px 0">
<div class="logo">Please enter password to browse site</div>
<!-- Main Form -->
<div class="login-form-1">
<form id="protect-form" name="protect-form" class="protect-form text-left" method="post">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="password">
</div>
<div class="form-group login-group-checkbox">
<input type="checkbox" id="lg_remember" name="lg_remember">
<label for="lg_remember">remember</label>
</div>
</div>
<button type="submit" class="login-button"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
<!-- end:Main Form -->
</div>
<script>
/**
* Created by Faisal_pc on 4/9/2016.
*/

$(document).ready(function() {
$('#protect-form').validate({
rules: {
password: {

required: true
},

},
highlight: function(element) {
$(element).closest('.form-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid').closest('.form-group').removeClass('error').addClass('success');
},

submitHandler: function( form ) {

$.ajax({
url : '/wp-content/themes/website/protect.php',
data : $('#protect-form').serialize(),
type: "POST",
success : function(data){
console.log(data)
}
});
return false;
}
});

});











share|improve this question




















  • 1





    If error code is 500 it's server error, what do you think?

    – Konstantin Kudelko
    Nov 22 '18 at 12:39











  • So what exactly the problem ??

    – H. Ghass
    Nov 22 '18 at 12:40











  • sorry, don't know php

    – Konstantin Kudelko
    Nov 22 '18 at 12:47











  • The page you try to redirect exists? Does not seem so.

    – pr1nc3
    Nov 22 '18 at 12:48











  • you mean the path is wrong ?

    – H. Ghass
    Nov 22 '18 at 12:49














0












0








0








I try to enter password when I open website, if the password true it will redirect me to the index.php, if the pass wrong it will let me try again.
But why does it return internal error 500 ?



jquery-1.12.4.min.js:4 GET http://www.website.com/wp-content/themes/website/index.php 500 (Internal Server Error)


This is my php code (protect.php)



<?php
if( isset($_POST["password"])){
if ($_POST["password"] == "1234"){

header("Location:/wp-content/themes/website/index.php");
exit();
}
else{
echo "false";
}
}


and this is my form with ajax (home.php). I think the problem here at the bottom in ajax ? :/



<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" 
rel="stylesheet" id="bootstrap-css">
<link href="<?php echo get_template_directory_uri() .
'/css/websiteProtect.css'; ?>" rel="stylesheet">

<link href="<?php echo get_template_directory_uri() . '/css/bootstrap.min.css'; ?>" rel="stylesheet">

<!------ Include the above in your HEAD tag ---------->

<!-- All the files that are required -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<script src="<?php echo get_template_directory_uri() . '/js/vendor/jquery-1.12.4.min.js'; ?>"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<!-- Where all the magic happens -->
<!-- LOGIN FORM -->
<div class="text-center" style="padding:50px 0">
<div class="logo">Please enter password to browse site</div>
<!-- Main Form -->
<div class="login-form-1">
<form id="protect-form" name="protect-form" class="protect-form text-left" method="post">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="password">
</div>
<div class="form-group login-group-checkbox">
<input type="checkbox" id="lg_remember" name="lg_remember">
<label for="lg_remember">remember</label>
</div>
</div>
<button type="submit" class="login-button"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
<!-- end:Main Form -->
</div>
<script>
/**
* Created by Faisal_pc on 4/9/2016.
*/

$(document).ready(function() {
$('#protect-form').validate({
rules: {
password: {

required: true
},

},
highlight: function(element) {
$(element).closest('.form-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid').closest('.form-group').removeClass('error').addClass('success');
},

submitHandler: function( form ) {

$.ajax({
url : '/wp-content/themes/website/protect.php',
data : $('#protect-form').serialize(),
type: "POST",
success : function(data){
console.log(data)
}
});
return false;
}
});

});











share|improve this question
















I try to enter password when I open website, if the password true it will redirect me to the index.php, if the pass wrong it will let me try again.
But why does it return internal error 500 ?



jquery-1.12.4.min.js:4 GET http://www.website.com/wp-content/themes/website/index.php 500 (Internal Server Error)


This is my php code (protect.php)



<?php
if( isset($_POST["password"])){
if ($_POST["password"] == "1234"){

header("Location:/wp-content/themes/website/index.php");
exit();
}
else{
echo "false";
}
}


and this is my form with ajax (home.php). I think the problem here at the bottom in ajax ? :/



<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" 
rel="stylesheet" id="bootstrap-css">
<link href="<?php echo get_template_directory_uri() .
'/css/websiteProtect.css'; ?>" rel="stylesheet">

<link href="<?php echo get_template_directory_uri() . '/css/bootstrap.min.css'; ?>" rel="stylesheet">

<!------ Include the above in your HEAD tag ---------->

<!-- All the files that are required -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>

<script src="<?php echo get_template_directory_uri() . '/js/vendor/jquery-1.12.4.min.js'; ?>"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<!-- Where all the magic happens -->
<!-- LOGIN FORM -->
<div class="text-center" style="padding:50px 0">
<div class="logo">Please enter password to browse site</div>
<!-- Main Form -->
<div class="login-form-1">
<form id="protect-form" name="protect-form" class="protect-form text-left" method="post">
<div class="login-form-main-message"></div>
<div class="main-login-form">
<div class="login-group">
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="password">
</div>
<div class="form-group login-group-checkbox">
<input type="checkbox" id="lg_remember" name="lg_remember">
<label for="lg_remember">remember</label>
</div>
</div>
<button type="submit" class="login-button"><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
<!-- end:Main Form -->
</div>
<script>
/**
* Created by Faisal_pc on 4/9/2016.
*/

$(document).ready(function() {
$('#protect-form').validate({
rules: {
password: {

required: true
},

},
highlight: function(element) {
$(element).closest('.form-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid').closest('.form-group').removeClass('error').addClass('success');
},

submitHandler: function( form ) {

$.ajax({
url : '/wp-content/themes/website/protect.php',
data : $('#protect-form').serialize(),
type: "POST",
success : function(data){
console.log(data)
}
});
return false;
}
});

});








javascript php ajax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 15:30









Svenmarim

9162729




9162729










asked Nov 22 '18 at 12:38









H. GhassH. Ghass

308




308








  • 1





    If error code is 500 it's server error, what do you think?

    – Konstantin Kudelko
    Nov 22 '18 at 12:39











  • So what exactly the problem ??

    – H. Ghass
    Nov 22 '18 at 12:40











  • sorry, don't know php

    – Konstantin Kudelko
    Nov 22 '18 at 12:47











  • The page you try to redirect exists? Does not seem so.

    – pr1nc3
    Nov 22 '18 at 12:48











  • you mean the path is wrong ?

    – H. Ghass
    Nov 22 '18 at 12:49














  • 1





    If error code is 500 it's server error, what do you think?

    – Konstantin Kudelko
    Nov 22 '18 at 12:39











  • So what exactly the problem ??

    – H. Ghass
    Nov 22 '18 at 12:40











  • sorry, don't know php

    – Konstantin Kudelko
    Nov 22 '18 at 12:47











  • The page you try to redirect exists? Does not seem so.

    – pr1nc3
    Nov 22 '18 at 12:48











  • you mean the path is wrong ?

    – H. Ghass
    Nov 22 '18 at 12:49








1




1





If error code is 500 it's server error, what do you think?

– Konstantin Kudelko
Nov 22 '18 at 12:39





If error code is 500 it's server error, what do you think?

– Konstantin Kudelko
Nov 22 '18 at 12:39













So what exactly the problem ??

– H. Ghass
Nov 22 '18 at 12:40





So what exactly the problem ??

– H. Ghass
Nov 22 '18 at 12:40













sorry, don't know php

– Konstantin Kudelko
Nov 22 '18 at 12:47





sorry, don't know php

– Konstantin Kudelko
Nov 22 '18 at 12:47













The page you try to redirect exists? Does not seem so.

– pr1nc3
Nov 22 '18 at 12:48





The page you try to redirect exists? Does not seem so.

– pr1nc3
Nov 22 '18 at 12:48













you mean the path is wrong ?

– H. Ghass
Nov 22 '18 at 12:49





you mean the path is wrong ?

– H. Ghass
Nov 22 '18 at 12:49












1 Answer
1






active

oldest

votes


















0














Try to use absolute way in header() function.



Location: http://example.com/wp-content/themes/website/index.php



or $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF']



official docs: http://php.net/manual/en/function.header.php






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431238%2ffailed-to-load-source-server-responds-with-500%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Try to use absolute way in header() function.



    Location: http://example.com/wp-content/themes/website/index.php



    or $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF']



    official docs: http://php.net/manual/en/function.header.php






    share|improve this answer




























      0














      Try to use absolute way in header() function.



      Location: http://example.com/wp-content/themes/website/index.php



      or $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF']



      official docs: http://php.net/manual/en/function.header.php






      share|improve this answer


























        0












        0








        0







        Try to use absolute way in header() function.



        Location: http://example.com/wp-content/themes/website/index.php



        or $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF']



        official docs: http://php.net/manual/en/function.header.php






        share|improve this answer













        Try to use absolute way in header() function.



        Location: http://example.com/wp-content/themes/website/index.php



        or $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF']



        official docs: http://php.net/manual/en/function.header.php







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 13:02









        nuckninenucknine

        34




        34
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431238%2ffailed-to-load-source-server-responds-with-500%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith