These code can work in wampserver localhost but I apply in hostinger, it cannot work. Why like that? Where is the main issue occur?

I’m beginner for developing website using hostinger cpanel. Currently, I want to create login page and the form action will link to the file manager process.php. I create the new table called “login” in the u472535631_kanguh database. Based on the current table, I have added two columns which are id and password. I also try to insert the data inside the columns. The directory of file manager will be

u472535631> public_html> wp_content> themes> main> process.php

MySql Database: u472535631_kanguh

MySql User: u472535631_panguh

MySql Password:123456789

IP Address:

Username: u472535631

Server IP: 32.180.454.10

Home root: /home/u472535631


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");

// 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);


if($row['ID'] == $username && $row['Password'] == $password){
    header( 'Location:  http://wins134/login' ) ; 
        die("Wrong Code Entered");
    echo "Failed to login!";


login page in wordpress

<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 class="main">
            <table style="width:auto;height:auto;border:0;margin-left:-55px;">
                <td width="51" height="27">Username:</td>
                <td colspan="2"><input name="user" type="text" class="textbox" id="user" maxlength="20"/></td>
                <td height="27">Password:</td>
                <td colspan="2"><input name="pass" type="password"  class="textbox" id="pass" /></td>
                <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>
                <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>


$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');

According to these codes, I can work in the localhost but cannot work in the hostinger. Why will this happen? Where is the problem occurred? Form action or process.php?
The result will be nothing when the user use the correct username and password and vice versa.

Please help me to solve the current problem. Thank you.

Read more here: These code can work in wampserver localhost but I apply in hostinger, it cannot work. Why like that? Where is the main issue occur?

Leave a Reply

Your email address will not be published. Required fields are marked *