I have this code on the page "GetUsers.php"
<form action="actions/getusers.php" method="post">
<div class="form-group">
<label for="user">User:</label>
<input type="text" class="form-control" id="user" name="user">
</div>
<button type="submit" name="Form" id="Form" class="btn btn-default">Manage</button>
</form>
While on "actions/getusers.php", I have this:
<?php
include('../../config.php');
session_start();
if( isset($_SESSION['password']) && $_SESSION['password']==$usdb_config['adminpassword'] ) {
return true;
}
if( !isset($_SESSION['password']) ) {
header("Location: ../login.php");
die();
}
if( isset($_SESSION['password']) && $_SESSION['password']!==$usdb_config['adminpassword'] ) {
header("Location: ../login.php");
die();
}
require('../../other/casesensitivecfg.php');
$AdminPassword = $_SESSION['password'];
$locationtodb = '../../database/'.$usdb_config['db_username'].$usdb_config['db_password'].$usdb_config['db_passphrase'].'/';
$users = file_get_contents($locationtodb.'users.txt');
$User = $_POST['user'];
$SearchUser = $User;
$pattern = preg_quote($SearchUser, '/');
$pattern = "/^.*$pattern.*\$/m";
preg_match_all($pattern, $users, $matches);
$wholeLine = implode("\n", $matches[0]);
$data = explode(":", $wholeLine);
// header('Content-Type: text/plain');
?>
And also this code between HTML codes in "actions/getusers.php" :
<?php
if( isset($_POST['Form']) ) {
echo '
<ul class="list-group">
<li class="list-group-item"><strong>User Owner: </strong>'.$data[2].'</li>
<li class="list-group-item"><strong>User: </strong>'.$data[0].'</li>
<li class="list-group-item"><strong>User Status: </strong>'.$data[1].'</li>
</ul>
';
}
if( !preg_match_all($pattern, $users, $matches) ) {
echo '<div class="alert alert-danger" role="alert">The user you entered does not exists!</div>';
}
if( $_POST['user']=="this_line_must_not_be_edited_or_removed" ) {
echo '<div class="alert alert-danger" role="alert">The user you entered does not exists!</div>';
}
?>
At last, after submitting the form on "GetUsers.php", I get blank page on "actions/getusers.php".