PHP programming

-
DIRECT ACCESS NOT ALLOWED

<?php include '../elements/header.php'; ?>
<?php
//load database connection
$host = "localhost";
$user = "root";
$utype = "";
$password = "";
$database_name = "mydb";
$pdo = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
// Search from MySQL database table
$search=$_POST['search'];
$query = $pdo->prepare("SELECT * from users WHERE username LIKE '%$search%' OR utype LIKE '%$search%' LIMIT 0 , 10");
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();
// Display search result
if (!$query->rowCount() ==0) {
echo "Search found :<br/>";
echo "<table style=\"font-family:arial;color:#333333;\">";
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">Username</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">password</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">utype</td></tr>";
while ($results = $query->fetch()) {
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['username'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['password'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['utype'];
echo "</td></tr>";
}
echo "</table>";
} else {
echo 'Nothing found';
}
?>

help please i can't put my header in this query
See more 

Your reply

1 reply

Posts
10916
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
December 10, 2018
0
Thank you
Does the WEB service provider have read access to the "../elements" folder?
Respond to ac3mark