0
So, I’m trying to create a page, really simple, to send some things to the database, (id,username,code_placa) but I’m not able to, when removing the lines that give error, the page opens, however, The upload button just refreshes the page and does not send anything to the database, could you help me? Errors that appear:
Warning: include(../../Templates/Hk_Head_2.php): failed to open stream: No such file or directory in /home/iceag061/public_html/hk/badges.php on line 2
Warning: include(../../Templates/Hk_Head_2.php): failed to open stream: No such file or directory in /home/iceag061/public_html/hk/badges.php on line 2
Warning: include(): Failed opening '../../Templates/Hk_Head_2.php' for inclusion (include_path='.:/opt/php56/lib/php') in /home/iceag061/public_html/hk/badges.php on line 2
Fatal error: Call to a member function query() on null in /home/iceag061/public_html/hk/badges.php on line 4
Code:
<?php
include "../../Templates/Hk_Head_2.php";
$query = $link->query('SELECT rank FROM usuarios WHERE username = "' .$username. '"');
while($row = mysqli_fetch_array($query))
{
$rangouser = $row['rank'];
}
if("$rangouser" == "2"){
header("Location: " . $_SERVER['HTTP_REFERER']);
exit;
}a
if("$rangouser" == "1"){
header("Location: " . $_SERVER['HTTP_REFERER']);
exit;
}
if("$rangouser" == "3"){
header("Location: " . $_SERVER['HTTP_REFERER']);
exit;
}
if("$rangouser" == "4"){
header("Location: " . $_SERVER['HTTP_REFERER']);
exit;
}
include "../../Templates/Hk_Nav.php";
?>
<div class="container">
<!-- Main component for a primary marketing message or call to action -->
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading blue">
<h3 class="panel-title"><?php echo $lang[426]; ?></h3>
</div>
<div class="panel-body">
<div class="formulariohk">
<form action="" method="post" enctype="multipart/form-data">
<label><?php echo $lang[418]; ?></label>
<input style="margin-bottom: 10px;" type="text" required="" class="form-control" name="id" placeholder="Id Da Placa" value="" /> <br>
<label><?php echo $lang[422]; ?></label>
<input style="margin-bottom: 10px;" type="text" required="" class="form-control" name="username" placeholder="Usuario" value="" /> <br>
<label><?php echo $lang[423]; ?></label><br>
<input style="margin-bottom: 10px;" type="text" required="" class="form-control" name="code_placa" placeholder="Codigo do emblema" value="" /> <br>
<center><input class="btn btn-primary" name="guardar" type="submit" value="<?php echo $lang[192]; ?>" style="width: 120px;" /></center>
</form>
<?php
if ($_POST['guardar'] && $_POST['titulo']) {
$enviar = "INSERT INTO usuarios_placas (id,username,code_placa) values ('".$username."','".strip_tags($_POST['id'])."','".strip_tags($_POST['username'])."','".$_POST['code_placa']."')";
if (@$link->query($enviar)) {
// Guardar acci贸n en Logs si se ha iniciado sesi贸n
$fecha_log = date("Y-m-d");
$accion = $lang[434];
$enviar_log = "INSERT INTO logs (usuario,accion,fecha) values ('".$username."','".$accion."','".$fecha_log."')";
$link->query($enviar_log);
// Log guardado en Base de datos
?>
<script type="text/javascript">
location.href ="<?php echo $_SERVER['HTTP_REFERER']; ?>";
</script>
<?php
}
}
?>
</div></div>
</div>
</div>
</div>
</div><!-- /container -->
<?php
include "../../Templates/Hk_Footer_2.php";
?>
Checks the file path called in include.
– Diego Vieira