Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6119759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:35:25+00:00 2026-05-23T15:35:25+00:00

Im doing a game and i created an administration panel for it. it works

  • 0

Im doing a game and i created an “administration” panel for it.
it works like this:

admin.php
admin/code1.php
admin/code2.php

admin.php:

<?php
include("lib.php");
$player = check_user($secret_key, $db);
if($player->rank != "Administrador")
{
header("Location: personagem.php");
exit;
}
include("templates/private_header.php");
head("Admin Panel","adminpanel.png");
startbox();
if(isset($_GET['page']))
{
include("admin/" . $_GET['page'] . ".php");
}
else
{
?>
<A href="admin.php?page=code1">Kill Players</a><br>
<A href="admin.php?page=code2">Heal Players</a><br>

<?php
}
endbox();
include("templates/footer.php");
?>

i want to know if im prone to hacking.
the code1.php and code2.php uses a custom query library that is included in lib.php so there is no way to execute them directly without falling in to an error.

Also in My template i have:

if($player->rank == "Administrador")
{
echo "<a href='admin.php'>Admin Panel</a>";
}

so i can access the panel more quickly.There is risk in there too?

Just note that $player is a object created from a query to the player Database that represents the actual player. In my thoughts the only way to hack this is changing they “rank” status in the table to “Administrador” am i right? or there is something i let pass?
Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:35:25+00:00Added an answer on May 23, 2026 at 3:35 pm

    Never trust user input

    Never work with any of $_GET $_POST, $_COOKIE without verifying them first (or anything else user-generated for that matter, even stuff from your own database might be dangerous).

    include("admin/" . $_GET['page'] . ".php");
    

    Don’t do this. otherwise you can include any file you want. I suggest you whitelist all allowed pages to be included like so:

    $allowed = array("admin_index", "page1", "page2");
    if(in_array($_GET['page'], $allowed)){
        include("admin/" . $_GET['page'] . ".php");
    }
    else{
        // perform error handling
    }
    

    Here’s a useful function that you could take a look at, if you don’t want to whitelist all pages: basename() – this will always only return the filename part, without any directory-changing part.

    Furthermore, I do not recommend you work with includes like this at all, but rather have some Controller-hierarchy that can decide what to do on each request.

    What about the authentication?

    Show us your code for the authentication. That’s a crucial part of your system that needs to be secure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm probably doing this wrong, so please be nice. I'm developing a Java game,
I want to get started doing some game development using Microsoft's XNA. Part of
I'm doing a chess game. In there, I want to move an element with
Continuing my quest of learning Java by doing a simple game, i stumbled upon
I'm creating a game with points for doing little things, so I have a
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Suppose you created an online game in HTML5/JavaScript. All the code would be downloaded
I created a grid array in OGRE3D game engine but the array is generic
So I have this database class in PHP and I only have 1 function
I have created a backgammon game in c++ that is played in console. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.