Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Help 

AJAX (HTTP_X_REQUESTED_WITH) not working on apache2 (debian)

Hey HF ✌

Im trying to get this code working to load sub pages, but since i changed my server to linux, its not working anymore.

Code:

PHP Code

<?php
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
    if(!isset(
$_GET['page'])){
        include(
'pages/index.php');
    }else{

        switch(
$_GET['page']){

            case 
'index':
                include(
'pages/index.php');
                break;
            case 
'settings':
                include(
'pages/settings.php');
                break;
            case 
'profile':
                include(
'pages/profile.php');
                break;
            case 
'terms':
                include(
'pages/terms.php');
                break;
            case 
'history':
                include(
'pages/connections.php');
                break;
            default:
                include(
'pages/index.php');
        }
    }
    exit;
}
?>

Greetings.
[Image: anime_girl_sig_by_gameriuxlt-d.png]
Did you install PHP correctly(try to run phpinfo())? Do you have any logs in apache(/var/log/apache2/error.log)? Did you set proper rights to folder/files?
What's the actual error? What do you mean its not working anymore.
(Jul 4, 2017 07:08 AM)TCP Wrote:  Did you install PHP correctly(try to run phpinfo())? Do you have any logs in apache(/var/log/apache2/error.log)? Did you set proper rights to folder/files?
Yes, seems fine.
[Image: fac5ebd239.png]

"Did you set proper rights to folder/files?"

I pointed my domain to the folder with the web files.

But..not more.
[Image: anime_girl_sig_by_gameriuxlt-d.png]
(Jul 4, 2017 07:16 AM)Exeption™ Wrote:  "Did you set proper rights to folder/files?"

I pointed my domain to the folder with the web files.

But..not more.

That's not what I meant, I mean the permissions of the files, you are able to see the phpinfo page from the domain?

Try also using $_SERVER['DOCUMENT_ROOT']."/pages/page.php" in include
"you are able to see the phpinfo page from the domain?"

Yes, it is.

"Try also using $_SERVER['DOCUMENT_ROOT']."/pages/page.php" in include"
EDIT:
Not working too. ^^
[Image: anime_girl_sig_by_gameriuxlt-d.png]
(Jul 4, 2017 07:39 AM)Exeption™ Wrote:  Not working too. ^^

Can you show me your current code? Also add error_reporting(E_ALL) and tell me about the apache logs
(Jul 4, 2017 07:54 AM)TCP Wrote:  Can you show me your current code? Also add error_reporting(E_ALL) and tell me about the apache logs

Thanks for your help mate.

Im switching now back to a Windows server 🤝

the apache logs did showed that the file could not found on the server.
(domain.com/index as example)

Have a nice day,

Im quitting linux again lol. -.-
[Image: anime_girl_sig_by_gameriuxlt-d.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by .eXeJul 23, 2018 03:48 AM 7 142 Jul 23, 2018 03:48 AM
Last Post: .eXe
[Help] by .eXeJul 20, 2018 01:33 PM 0 74 Jul 20, 2018 01:33 PM
Last Post: .eXe
[Help] by SvndayFeb 6, 2016 09:36 AM 5 121 Feb 6, 2016 09:36 AM
Last Post: JIM NASIUM'S GYMNASIUM