I am developing my web application. I have this piece of code:
<?php if($_SESSION['add'] == 1) echo '<input type="button" name="add" id="add" value="Add" onclick="add()" >'; if($_SESSION['edit'] == 1) echo '<input type="button" name="edit" id="edit" value="Edit" onclick="edit()">'; ?>
Basically, when a user logs in, I set session variables that indicate whether the user is allowed to modify or add entries. Therefore, when they get to the home page, I use this code to determine whether to show or not add add and edit buttons.
Is this code a violation of the logic / presentation separation rule? If so, how can I achieve separation?
I do not use any web frameworks.
optimization html php
Connor bishop
source share