The file path is:
wordpress/wp-content/themes/neve/index.php
"index.php" content is:
<?php
global $wpdb;
$result = $wpdb->get_results ( "SELECT * FROM users WHERE username = 'Peter'");
foreach ( $result as $results )
{
echo $results->id.'<br/>';
echo $results->username.'<br/>';
echo $results->password.'<br/>';
}
?>
It works!
But, when I change the content of the index.php, see below:
New "index.php" content is:
<?php
header("Location: http://34.92.209.11/wp-content/themes/neve/Test_PHP.php");
?>
Then the content of the "Test_PHP.php" is:
<?php
global $wpdb;
$result = $wpdb->get_results ( "SELECT * FROM users WHERE username = 'Peter'");
foreach ( $result as $results )
{
echo $results->id.'<br/>';
echo $results->username.'<br/>';
echo $results->password.'<br/>';
}
?>
It does not work, and shows "HTTP ERROR 500", why???
Only the file name called "index.php" can access the database?
I’ve been trying to find the answer.
I really hope someone can answer me.
Thank you so much!