Home » Php » php – I am getting 404 Not Found

php – I am getting 404 Not Found

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have a problem with my administration panel, when i try log in im getting 404 not found
Not Found
The requested URL was not found on this server.

what kind of problem can could be? anyone can help me?

in confige.php faile i have admin login details

$config['link']                 = "website";
$config['adminName']            = "admin";
$config['adminPassword']        = "pass";

my login function:

    public function login($uname,$upass)//nustatymai config.php faile
    {
        if($uname == $this->configs['adminName'] && $upass == $this->configs['adminPassword']) {
            $_SESSION['Admin'] = true;
            return true;
        } else return false;
   }

Here is my admin.php file.

<?php if(!isset($_SESSION['Admin']) && isset($_POST['username']) && isset($_POST['password'])) { if ($admin->login($_POST['username'], $_POST['password'])) { echo "Sveiki prisijungę!"; } else { echo "Blogi duomenys!"; } }else{ if(isset($_SESSION['Admin'])) { //////////////////////////////////////////////////////////////////////////////////////////////////////////// // Veiksmai //////////////////////////////////////////////////////////////////////////////////////////////////////////// if(isset($_POST['site_title']) || isset($_POST['des']) || isset($_POST['keys']) || isset($_POST['side'])){ $stmt = $db->prepare("UPDATE configs SET Title=:title, Des=:des, Keywords=:keys, Side=:side, MaxPrac=:maxprac"); $stmt->bindParam(':title', $_POST['site_title'], PDO::PARAM_STR); $stmt->bindParam(':des', $_POST['des'], PDO::PARAM_STR); $stmt->bindParam(':keys', $_POST['keys'], PDO::PARAM_STR); $stmt->bindParam(':side', $_POST['side'], PDO::PARAM_STR); $stmt->bindParam(':maxprac', $_POST['maxprac'], PDO::PARAM_STR); //$stmt->bindParam(':filmID', $_POST['filmID'], PDO::PARAM_INT); $stmt->execute(); echo '<p class="bg-primary">Nustatymai atnaujinti!</p>'; } //pridedam kategoriją if(isset($_POST['category'])){ if(!empty($_POST['category'])) { if ($admin->add_cat($_POST['category'])) { echo '<p class="bg-primary">Pridėjote kategoriją!</p>'; } else { echo '<p class="bg-danger">Neįrašėte pavadinimo!</p>'; } } else { echo "Neįvedėte pavadinimo!"; } } //triname kategoriją if(isset($_GET['delcat'])){ if ($admin->del_cat($_GET['delcat'])) { echo "Kategorija ištrinta!"; header('Location: ' . $_SERVER['HTTP_REFERER']); } else { header('Location: ' . $_SERVER['HTTP_REFERER']); } } //redaguojame kategoriją if(isset($_POST['edit_name']) && isset($_POST['cat_id'])){ if ($admin->edit_cat($_POST['edit_name'],$_POST['cat_id'])) { echo "Kategorijos pavadinimas pakeistas!"; header('Location: ' . $_SERVER['HTTP_REFERER']); } else { echo "Kažkas blogai!"; header('Location: ' . $_SERVER['HTTP_REFERER']); } } //pridedame pratybas if(isset($_FILES['image']) && isset($_POST['practitle'])){ if(!empty($_POST['practitle'])) { if($admin->add_prac($_POST['practitle'],$_POST['pages'],$_POST['pcategory'])) { $errors = array(); $file_size = $_FILES['image']['size']; $file_tmp = $_FILES['image']['tmp_name']; $file_type = $_FILES['image']['type']; $file_ext = strtolower(end(explode('.', $_FILES['image']['name']))); $insertId = $db->lastInsertId(); $file_name = $insertId."_cover.".$file_ext; $expensions = array("jpeg", "jpg", "png", "bmp"); if (in_array($file_ext, $expensions) === false) { $errors[] = "Blogas failo tipas."; } if ($file_size > 2097152) { $errors[] = 'File size must be excately 2 MB'; } if (empty($errors) == true) { move_uploaded_file($file_tmp, "uploads/" . $file_name); $stmt = $db->prepare("UPDATE practice SET Cover=? WHERE id=?"); header('Location: ' . $config['link'].'/admin.html?editprac='.$insertId); $stmt->execute(array($file_name, $insertId)); } else { print_r($errors); } } }else { echo "Nepakanka duomenų, kad būtų sukurtos pratybos!"; } } // triname pratybas if(isset($_GET['delprac'])){ if ($admin->del_prac($_GET['delprac'])) { echo "Pratybos ištrintos!"; } } //redaguojame pratybas if(isset($_POST['prac_id']) && isset($_POST['epractitle'])){ if ($admin->edit_prac($_POST['ecategory'],$_POST['epractitle'],$_POST['epages'],$_POST['prac_id'])) { echo "Pratybos sekmingai redaguotos"; //header('Location: ' . $_SERVER['HTTP_REFERER']); $check = @getimagesize($_FILES["eimage"]["tmp_name"]); if($check){ $stmt = $db->query('SELECT * FROM practice WHERE id='.$_POST['prac_id'].' LIMIT 1'); $rows = $stmt->fetch(PDO::FETCH_ASSOC); unlink("./uploads/".$rows['Cover']); $file_name = UploadImage("eimage", $_POST['prac_id']."_cover"); $stmt = $db->prepare("UPDATE practice SET Cover=? WHERE id=?"); $stmt->execute(array($file_name, $_POST['prac_id'])); } //pusalapių kėlimas for($i = 1; $i < $_POST['epages']+1; $i++){ $check = @getimagesize($_FILES["image".$i]["tmp_name"]); if($check) { UploadImage("image".$i, $_POST['prac_id']."_".$i); } } header('Location: ' . $_SERVER['HTTP_REFERER']); } else { echo "Kažkas blogai!"; header('Location: ' . $_SERVER['HTTP_REFERER']); } } //pratybų puslapio trinimas if(isset($_GET['delimg'])){ unlink("./uploads/".$_GET['delimg']); header('Location: ' . $_SERVER['HTTP_REFERER']); } //////////////////////////////////////////////////////////////////////////////////////////////////////////// // Atvaizdavimai //////////////////////////////////////////////////////////////////////////////////////////////////////////// ?> <?php if($_GET['page'] == "category") { ?> <div class="input-group col-md-4 left"> Kategorijos pridėjimas: <form action="admin.html" method="post"> <input name = "category" type="text" class="form-control" placeholder="Įrašykite naujos kategrijos pavadinimą!"> <span class="input-group-btn"> <button class="btn btn-default" type="submit">Pridėti</button> </span> </form> </div> <table class="table"> <thead> <tr> <th>Pavadinimas</th> <th>Veiksmai</th> </tr> </thead> <tbody> <?php $i = 0; $id = array(); $stmt = $db->query('SELECT * FROM category'); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $id[ $i ] = $row['id']; echo '<tr><td>'.$row['Name'].'</td><td><a href="./admin.html?delcat='.$row['id'].'"><i class="fa fa-trash-o"></i></a> <a href = "#" data-toggle="modal" data-target="#edit_'.$i.'"><i class="fa fa-pencil"></i></a> </td></tr>'; $i++; } ?> </tbody> </table> <?php } //sumetam langus for( $j = 0; $j < $i; $j++) { ?> <div class="modal fade" id="edit_<?php echo $j; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">Kategorijos redagavimas <?php echo $id[$j]; ?></h4> </div> <div class="modal-body"> <form action="admin.html" method="post"> <div class="input-group"> <input name="cat_id" type="hidden" value="<?php echo $id[$j]; ?>"> <input style = "width: 100%" name = "edit_name" class="form-control input-lg" placeholder="Naujas jūsų kategorijos pavadinimas" type="text"> </div> </div> <div class="modal-footer"> <button type='submit' class="btn btn-primary">Keisti</button> </div> </form> </div> </div> </div> <?php } //puslapiai if($_GET['page'] == "settings") { ?> <form action="admin.html" method="post" id="prac"> Pavadinimas:<br> <textarea name="site_title" rows="5" cols="40"><?php echo $config['Title']; ?></textarea><br> Aprašymas:<br> <textarea name="des" rows="5" cols="40"><?php echo $config['Des']; ?></textarea><br> Raktažodžiai:<br> <textarea name="keys" rows="5" cols="40"><?php echo $config['Keywords']; ?></textarea><br> Dešinėje (reklamos ir panašiai):<br> <textarea name="side" rows="5" cols="40"><?php echo $config['Side']; ?></textarea><br> Viso puslapių<br> <textarea name="maxprac" rows="1" cols="5"><?php echo $config['MaxPrac']; ?></textarea><br> <button type='submit' class="btn btn-primary">Išsaugoti</button> </form> <?php } if($_GET['page'] == "practice") { ?> <div class="container-fluid"> Pratybų įkėlimas <form action="admin.html" enctype="multipart/form-data" method="post" id="prac"> <div class="form-group"> <input name = "practitle" class="form-control" placeholder="Įrašykite pratybų pavadimimą" type="text"> <input name = "pages" class="form-control" placeholder="Puslapių skaičius" type="text"> </div> Kategorija: <select name="pcategory" form="prac" class="btn btn-default"> <?php $stmt = $db->query('SELECT * FROM category'); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {?> <option value="<?php echo $row['id']; ?>"> <?php echo $row['Name']; ?></option> <?php } ?> </select><br><br> <input type="file" name="image" id="image"><br> <button type='submit' class="btn btn-primary">Pridėti</button> </form> </div> <table class="table"> <thead> <tr> <th>Pavadinimas</th> <th>Veiksmai</th> </tr> </thead> <tbody> <?php $stmt = $db->query('SELECT * FROM category'); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo '<tr class="success" ><td>'.$row['Name'].'</td><td><a href="./admin.html?delcat='.$row['id'].'"></td></tr>'; $stmts = $db->query('SELECT * FROM practice WHERE Category = '.$row['id'].''); while($prow = $stmts->fetch(PDO::FETCH_ASSOC)) { echo '<tr><td>'.$prow['Title'].'</td><td><a href="./admin.html?delprac='.$prow['id'].'"><i class="fa fa-trash-o"></i></a> <a href="./admin.html?editprac='.$prow['id'].'"><i class="fa fa-pencil"></i></a> </td></tr>'; } } ?> </tbody> </table> <?php } // redagavimas pratybų if(isset($_GET['editprac'])) { ?> Redaguoti pratybas <?php $stmt = $db->query('SELECT * FROM practice WHERE id='.$_GET['editprac'].' LIMIT 1'); $rows = $stmt->fetch(PDO::FETCH_ASSOC); ?> <form action="admin.html" enctype="multipart/form-data" method="post" id="prac"> <div class="form-group"> <input name = "epractitle" class="form-control" placeholder="<?php echo $rows['Title']; ?>" value="<?php echo $rows['Title']; ?>" type="text"> <input name = "prac_id" value="<?php echo $rows['id']; ?>" type="hidden"> <input name = "epages" class="form-control" placeholder="<?php echo $rows['Pages']; ?>" value="<?php echo $rows['Pages']; ?>" type="text"> </div> Kategorija: <select name="ecategory" form="prac" class="btn btn-default"> <?php $stmt = $db->query('SELECT * FROM category'); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {?> <option value="<?php echo $row['id']; ?>" <?php if($row['id'] == $rows['Category']) echo "selected"; ?>> <?php echo $row['Name']; ?></option> <?php } ?> </select><br><br> <img src="./uploads/<?php echo $rows['Cover']; ?>"/> <input type="file" name="eimage" id="eimage"><br> <table class="table"> <thead> <tr> <th>#</th> <th>Veiksmai</th> </tr> </thead> <tbody> <?php for( $j = 1; $j < $rows['Pages']+1; $j++) { //ciklas per visus puslapius $img_name = $rows['id'].'_'.$j;//pratybų id ir puslapio id echo "<tr><td>".$j."</td>"; if ( exsiImage($img_name)){ //tikrinam ar failas egzistuoja echo '<td><a href="./admin.html?delimg='.$img_name.'.'.exsiImage($img_name).'"><i class="fa fa-trash-o"></i> Ištrinti</a></td>'; } else { echo '<td><input type="file" name="image'.$j.'" id="image'.$j.'"></td>'; } echo "</tr>"; } ?> </tbody> </table> <button type='submit' class="btn btn-primary">Išsaugoti</button> </form> <?php } if(!isset($_GET['page']) && !isset($_GET['editprac'])) { echo "<h5>Sveiki prisijungę prie administratoriaus pulto</h5>"; }?> <?php }else{ ?> <form class="col-lg-12" action="admin.html" method="post"> <div class="input-group" style="width:340px;text-align:center;margin:0 auto;"> <input name = "username" class="form-control input-lg" placeholder="Administratoriaus vardas" type="text"> <input name = "password" class="form-control input-lg" placeholder="Password" type="password"> </div> <button type='submit' class="btn btn-primary">Prisijungti</button> </form> <?php } } ?> </div>

where is a problem with code my friends? 🙂
thank you

How to&Answers: