thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

I'm having issue where I update anything in admin, it's still not updating. It's just creating another new page. But not one page, it's like double uping pages. #247

Open saweetha opened 6 years ago

saweetha commented 6 years ago

If I add one page, the out come is two pages. How to solve this issue ?

creptor commented 6 years ago

please post the code here, it should be a simple code error.

saweetha commented 6 years ago

This is the index.php

<?php

Start the session:

session_start();

if(!isset($_SESSION['username'])) { header('Location: login.php'); }

?>

<?php include('config/setup.php'); ?>

<!DOCTYPE html>

<?php echo $page['title'].'| '.$site_title; ?>

Admin Dashboard

Page was '.$action.'!

'; } else { $message = '

Page could not be '.$action.' because: '.mysqli_error($dcb); $message .= '

'.$q.'

'; } } ?>
creptor commented 6 years ago

Try changing the $_GET['id'] on the $q for $_POST['id'] on the update statement or the other way around.

creptor commented 6 years ago

Also, the input for the id is not closed

saweetha commented 6 years ago

it showing a syntax error if I close the id

creptor commented 6 years ago

please provide the error

saweetha commented 6 years ago

It never shows error, my admin page contain just dissapear.

creptor commented 6 years ago

Try changing the form action from:

<form action="index.php?id=<?php echo $opened['id']; ?>" ...>

To

<form action="index.php?page=#insert_page_here#&id=<?php echo $opened['id']; ?>" ...>

The page is the name you're accessing in the admin dashboard, for example my page would be page_adm.

saweetha commented 6 years ago

Sir, still I'm having the updating issue.

creptor commented 6 years ago

Does your code still updates twice? Or updates the page while creating a new one?