• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP-ZNOTE] Check if is the admin

lubunttu

New Member
Joined
May 17, 2016
Messages
107
Reaction score
2
I tried put it:
if (is the admin) {
Show Admins Options in myaccount.php

But when i put it, when i open myaccount.php not show nothing, only a blank page

What i made worng?
Code:
    <?php
     <!-- admin page -->
       if (is_admin($user_data)) {
       <h3>Admin Page:</h3>
         <a href='admin.php'>Admin Page</a></br>
         <a href='admin_news.php'>Admin News</a></br>
         <a href='admin_gallery.php'>Admin Gallery</a></br>
         <a href='admin_skills.php'>Admin Skills</a></br>
         <a href='admin_reports.php'>Admin Reports</a></br>
         <a href='admin_helpdesk.php'>Admin Helpdesk</a></br>
         <a href='admin_shop.php'>Admin Shop</a>
         </br>
       }
     ?>

Full Code myaccount.php
http://pastebin.com/6EMCFvt9
 
So without looking into how znote works, if is_admin is a function or $user_data is populated there is an immediate error that stands out:

You are writing HTML (or output in general) inside the PHP code tags, which means the PHP interpreter is trying to run your HTML code as PHP.
Instead you can do something like this:
PHP:
    <?php
   if (is_admin($user_data)) {
    ?>   
     <!-- admin page -->
      
       <h3>Admin Page:</h3>
         <a href='admin.php'>Admin Page</a></br>
         <a href='admin_news.php'>Admin News</a></br>
         <a href='admin_gallery.php'>Admin Gallery</a></br>
         <a href='admin_skills.php'>Admin Skills</a></br>
         <a href='admin_reports.php'>Admin Reports</a></br>
         <a href='admin_helpdesk.php'>Admin Helpdesk</a></br>
         <a href='admin_shop.php'>Admin Shop</a>
         </br>
    <?php
       }
     ?>
 
So without looking into how znote works, if is_admin is a function or $user_data is populated there is an immediate error that stands out:

You are writing HTML (or output in general) inside the PHP code tags, which means the PHP interpreter is trying to run your HTML code as PHP.
Instead you can do something like this:
PHP:
    <?php
   if (is_admin($user_data)) {
    ?>  
     <!-- admin page -->
     
       <h3>Admin Page:</h3>
         <a href='admin.php'>Admin Page</a></br>
         <a href='admin_news.php'>Admin News</a></br>
         <a href='admin_gallery.php'>Admin Gallery</a></br>
         <a href='admin_skills.php'>Admin Skills</a></br>
         <a href='admin_reports.php'>Admin Reports</a></br>
         <a href='admin_helpdesk.php'>Admin Helpdesk</a></br>
         <a href='admin_shop.php'>Admin Shop</a>
         </br>
    <?php
       }
     ?>

Lol, ty...
I saw a video in portugueses the guy say codes in HTML work inside php
Maybe i understand him worng
 
Back
Top