Hi I’m beginner for developing website by using Hostinger cpanel. Currently, I have faced some problem which is “thepage is currently unable to handle this request” and also known as HTTP Error 500. All I did can be worked in localhost wordpress but it cannot done in hostinger wordpress. what is the problem, could someone tell me what is the solution?

process.php (Put in File manager (Directory: u472535631> public_html> wp_content> themes> main> process.php))

    <?php
error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

// connect to the server and select database
mysql_connect("u472535631_kanguh", "u472535631_kanguh", "123456789");
mysql_select_db("u472535631_kanguh"); 

// Get values passe from form in login.php file
$username = $_POST['user'];
$password = $_POST['pass'];

// to prevent mysql injection
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

// Query the database for user
$result = mysql_query("select * from login where ID = '$username' and Password = '$password'")
            or die("Failed to query database ".mysql_error());
$row = mysql_fetch_array($result);

session_start();

if($row['ID'] == $username && $row['Password'] == $password){
    if(isset($_POST["captcha"])&&$_POST["captcha"]!=""&&$_SESSION["code"]==$_POST["captcha"]){
    header( 'Location:  http://wins134/login' ) ; 
    }
    else{
        die("Wrong Code Entered");
    }
}
else{
    echo "Failed to login!";
}
?>

WordPress (Login page)

    <form id="form1" name="form1" method="post" action="../../wp-content/themes/main/process.php" onsubmit="return check();">
<div class="dibg">
    <div class="border">
        <div class="shuo">
            <div class="shuo_img"><img class="alignnone size-full wp-image-11" src="../wp-content/uploads/2017/04/shuo.jpg" alt="" width="70" height="95" /></div>
            <div class="shuo_txt"><h2><stong>Login Page</stong></h2></div>
        </div>
        <div class="main">
            <table style="width:auto;height:auto;border:0;margin-left:-55px;">
              <tr>
                <td width="51" height="27">Username:</td>
                <td colspan="2"><input name="user" type="text" class="textbox" id="user" maxlength="20"/></td>
              </tr>
              <tr>
                <td height="27">Password:</td>
                <td colspan="2"><input name="pass" type="password"  class="textbox" id="pass" /></td>
              </tr>
              <tr>
                <td height="33">Captcha:</td>
                <td width="65"><input name="captcha" type="text"  class="textbox1" id="captcha" size="6" maxlength="4" /></td>
                <td width="79"><div style="padding:2 0 0 5px; cursor:pointer; width:50px;"><img src="../../wp-content/themes/main/captcha.php" name="yzm" width="50" height="20" id="yzm" title="Click"/></div></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><input type="submit" id="btn" name="submit" value="Submit"  class="button"/></td>
                <td><input type="reset" name="cz" id="btn" value="Reset"  class="reset"/></td>
              </tr>
          </table>
        </div>
</div>
</div>
</form>

captcha.php(Put in File manager (Directory: u472535631> public_html> wp_content> themes> main> capthca.php))

    <?php
session_start();
$code=rand(1000,9999);
$_SESSION["code"]=$code;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 22, 86, 165); //background color blue
$fg = imagecolorallocate($im, 255, 255, 255);//text color white
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5,  $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>

Thank you.

Read more here: Why the page isn’t working? thepage is currently unable to handle this request HTTP Error 500


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: