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 6924955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:43:41+00:00 2026-05-27T10:43:41+00:00

Is it possible to include something in PHP without passing the variables that were

  • 0

Is it possible to include something in PHP without passing the variables that were passed to the original script?

I am using Joomla, and I am getting the error documented here (“Illegal Variables …”). The php script is an AJAX script that sends data back to the browser, so this script takes a lot of POST variables, does a database query, then echos the result. I am trying to tighten up security, so I put an include in this script to authenticate the user with the built it Joomla modules. I got the idea from here for the user authentication script.
The authentication script works for some pages, but with others I get the error mentioned above. So I want to include the authentication script without passing any variables to it. Is this possible?

EDIT: Here is a little more detail.

In the ajax script I have this:

<?php
    include '/var/www/joomla-auth.php';
...

below here is the script, basically the “joomla-auth.php” included script takes care of getting the username and password for a mysql query. Contents of joomla-auth:

<?php

define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

/* Create the Application */
$mainframe =& JFactory::getApplication('site');

/* Make sure we are logged in at all. */
if (JFactory::getUser()->id == 0)
    die("Access denied: login required.");

$user =& JFactory::getUser();

I am pretty sure it is the define or require lines that is throwing the error:

Illegal variable _files or _env or _get or _post or
_cookie or _server or _session or globals passed to script.

As documented in the first link above.

EDIT 2:

The ‘joomla-auth.php’ script makes $username and $password variables which are then used in the AJAX script. I tried this at the top of the AJAX script:

function get_creds(){
    include '/var/www/joomla-auth.php';
    return Array($username,$password);
}

$creds = get_creds();
$username = $creds[0];
$password = $creds[1];
....

But still the $_POST variables are being passed to /var/www/joomla-auth.php 🙁

  • 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-27T10:43:42+00:00Added an answer on May 27, 2026 at 10:43 am

    Joomla throws this error if you’re passing it one of the vars mentioned in your error to the url (or via mod_rewrite):

    _files or _env or _get or _post or _cookie or _server or _session

    Besides, I think the same error is thrown if you’re passing a whole numeric variable, such as:

    http://yoursite.com/?123456=abc

    Just make sure you’re not passing any of these vars in the url. If you can’t find the problem, try to check what’s in the request before the error is thrown.

    I hope it helped!

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

Sidebar

Related Questions

Is it possible to INCLUDE other mysql scripts in a composite script? Ideally I
Is it possible to include view code in a plugin, such that an app
From a PHP script, is it possible to execute another PHP-script with different GET
In PHP, it's possible to include 1 php file in another php. Is there
I'm looking for a drop-in include script / class that dissects multipart/form-data and fills
As opposed to using an include, which executes the included php in the file...is
I'm relatively new to PHP and still getting the hang of what's possible. So
In PHP I've build a webpage that uses include() for loading parts of the
Is it possible to include one CSS file in another?
is it possible to include a servlet in a jsp page? if so how?

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.