Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2008
    Posts
    150
    Thanks
    24
    Thanked 0 Times in 0 Posts

    how to include php file from another server without bugs ??

    hello, i wanna include php file in one script of mine from another server without getting bugs in my script.

    inside that php file some important functions that i can't put in the same place with the script in the same server, and that is why i upload the file in other server and i include it inside the script...

    i did some more work on this thing in the last few days and here is what i ended with:-
    1. i can include the php file from the server "A" into my script in server "B", by using include("http://site.com/path/file.php"); and editing php.ini with setting allow_url_include = On
    2. when i include the php file from another server, it works find but the functions and the classes doesn't work.
    3. to get the access to the functions and the classes, i have to include the file with a different extension - such as '.inc' This way the php interpreter will not 'get in the way' and the text will be included normally.... so i have to include the file like this include("http://site.com/path/file.inc");
    4. i get huge problem by renaming the file in server "A" from 'file.php' to 'file.inc', because the server will consider it as a text and it will be viewable as a text in any browser !!

    so please anybody got any idea about how to get access to the functions and the classes without renaming the file extension ??? or anybody know good idea to make the file non-viewable in the browsers after renaming it to file.inc ???
    Okay...

  • #2
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    you can only include/require a file from a different server if you current server has outside access otherwise you cant do this. And to stop files being viewable use a .htacces deny all code
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P

  • #3
    Regular Coder
    Join Date
    Jul 2008
    Posts
    150
    Thanks
    24
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DJCMBear View Post
    you can only include/require a file from a different server if you current server has outside access otherwise you cant do this. And to stop files being viewable use a .htacces deny all code

    i know that my current server have to has outside access to include file from a different server...i mentioned previously about i edited php.ini for that...but the problem is i don't get access to the function and the classes inside the file with the '.php' extension as i explained...

    and about ur .htacces deny all code solution, i tried it but it deny the access for the browsers and the include too, so it makes me unable to access it by the including
    Okay...

  • #4
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    Location
    United Kindom
    Posts
    1,173
    Thanks
    14
    Thanked 136 Times in 136 Posts
    Quote Originally Posted by crazy.works
    and about ur .htacces deny all code solution, i tried it but it deny the access for the browsers and the include too, so it makes me unable to access it by the including
    Your server has to be set up wrong then because I have done this to secure files and I could still access them through include/require.

    Quote Originally Posted by crazy.works
    i know that my current server have to has outside access to include file from a different server...i mentioned previously about i edited php.ini for that...but the problem is i don't get access to the function and the classes inside the file with the '.php' extension as i explained...
    including a file on the same server or a different server its still calling the file and its contents so like i said before your set up must be wrong seeing as its not allowing you to use codes that are there.
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •