0

Hello, can you help me? I have a website ready and how do I create an admin panel, where after login, can the administrator change the website settings? For example, edit text, add text or div, change the look. Something like a bootstrap studio?

I would like it without systems like wordpress. Just create yourself where should I start? What's the point? Some tips?

TheCzechTayen
  • 209
  • 1
  • 13

1 Answers1

2

A good place to start when creating an administrator dashboard is storing values in a database and then building an administrator dashboard around those stored values so you can populate your site dynamically.

For the sake of simplicity let's say you wanted the ability to change the color of your navbar through the admin dashoard. You could accomplish this by storing the current color of the nav in a database and then echoing out the current color you wanted by making a call in you php file with SQL.

For example inside of the database you have the row nav_color set to #000000 in effect when the file executes your navbar would be that hex color in this case black. You could effectively update that color code in the database to #ffffff changing the navbar color to white.

File showing Navbar:

<?php

// Create connection
$conn = new mysqli('localhost', 'username', 'pass', 'database');
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT * FROM homepage_colors";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        $nav_color = $row['nav_color'];
    }
}
$conn->close();
?>
<!DOCTYPE html>
<html>
<body>
<nav style="color: <?php echo $nav_color; ?>"></nav>
</body>
</html>

As you can see this can be a lot of work, and can become a lot of backend development. Making requests to the database to pull information to populate your site. This is also a very very simple example, and doesn't take into account all of the security you need to build in to prevent different types of attacks on your site such as SQL Injection

I would suggest if you want to learn about creating an administrator dashboard for your site focus on learning about backend development, databases, SQL Queries, and good security practices.

Ian White
  • 96
  • 1
  • 7
  • Thank you, I'll try to put it together with my friend. – TheCzechTayen Aug 11 '18 at 13:02
  • No problem. If you feel like this answer is correct, please select my answer as the accepted answer to your question. Also here are a few examples that you can learn from regarding SQL, and php web development. [W3](https://www.w3schools.com/php/php_mysql_intro.asp), [SQL - Code Academy](https://www.codecademy.com/learn/learn-sql), [Udemy](https://www.udemy.com/web-development-html5-css3-php-oop-and-mysql-database/) – Ian White Aug 11 '18 at 13:09