I have a function printContent()
which prints the arguments and logged()
which checks if the user is logged in.
My point is to do something like this:
logged("printContent('TITLE', 'CONTENT', 1)", 1);
It doesn't work. It should printContent()
if user is not logged in, but nothing is happening. If I'll try changing return()
into print()
it prints the text "printContent(text...)".
Here are these two functions:
function logged($echo = 0, $logout = 0)
{
if($_SESSION['user'])
{
if($echo)
{
if(!($logout)) return $echo;
else return false;
}
else return true;
}
else
{
if($logout == 1) return $echo;
else return false;
}
}
function printContent($title, $content, $type = 0){
if($type == 1){
echo '<div class="right-box">';
if($title) echo '<h3>'.$title.'</h3>';
echo $content.'</div>';
}
else {
echo '<div class="left-box">';
if($title) echo '<h2>'.$title.'</h2>';
echo '<div class="left-box-content">'.$content.'</div></div>';
}
}