General PHP Applications


By echai
Follow

Incapsula is deployed as a reverse proxy in front of your PHP application. This means that all traffic coming to your site through Incapsula will be seen as coming from one of Incapsula IPs.

In order to make sure that your PHP application gets the correct user IP we have created this PHP script. By including this script anywhere in your application it will make sure that any reference to the user IP will use the correct IP address.

Was this article helpful?
10 out of 10 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    CoreSEC Blog

    What about ASP/.NET applications? What can i do in order to see correct user IP? Must i change settings to my IIS Server or exists any sample code for asp/.net webpages?

  • Avatar
    echai

    @coresec, we don’t have an Incapsula extension you can install yet. However, I opened a section with instructions for extracting the original client IP with ASP/.NET http://support.incapsula.com/entries/20375907-asp-net

  • Avatar
    Marvin Hlavac

    Any chance of creating a vBulletin plugin for this?

    I have briefly enabled and tested Incapsula on my vBulletin-based site, but I'm unable to use it permanently because of this IP issue.

  • Avatar
    Marvin Hlavac

    Just to add to my above comment, if you do decide to create a plugin for vBulletin, please do create one for version 3.8.x, not just for the latest v4.

  • Avatar
    echai

    @Marvin, did you try applying our generic PHP solution (attached to the original post)?

    Let me know if you need help doing that.

  • Avatar
    Marvin Hlavac

    Eldad, the reason I posted my question was because, at the time, I was unable to locate the appropriate PHP file to add your code to. The next day I found out it was the vBulletin's class_core.php file. That did the trick beautifully.

    Your readme file states that something needs to be added or edited on line 13, but I didn't edit anything, and it worked. It it necessary to edit there something?

  • Avatar
    echai

    @Marvin, thanks for the update. No need to change anything in “incapsula.php”.

    If you can spare a couple of minutes it would be great if you post your solution for vBulletin in our Community Q&A forum ( http://support.incapsula.com/forums/223241-community-questions-answers). Which file needs editing, what line of code to insert and any other details you can share. I am sure other users would appreciate it.

    Thanks!

     

  • Avatar
  • Avatar
    echai

    Thanks! Much appreciated.

  • Avatar
    Nathan Mead

    Worked great in OxyClassifieds.

    After uploading the incapsula.php file to ../public_html/include/

    Edit OxyClassifieds /include/include.php file and in the 'if(!$minimal) {' section,

    Add the following line:

    require_once($config_abs_path.'/include/incapsula.php');

     

  • Avatar
    HY1P Monitor

    ** incapsula.php** file not found, please reupload

    How about my site? http://hy1p.com/

    I can't get ip visitor after use incapsula

  • Avatar
    Blake Gripling

    What about Mediawiki and PHPBB?

  • Avatar
    Blake Gripling

    Er, sorry for the double-post, but I also need an Elgg plugin as well.

  • Avatar
    botimesh2012

    Hello. I'm a new user and I'm very happy with my choice. I have an eCommerce website built on Prestashop (php/mySQL).

    And it is true, when I check stats of visitors I see only Incapsula IP's.

    I needed just some hint, on where to include this script. Is it good and safe to include it in the header? Or footer? (If it should be included in other files it means that I should do it in hundreds of files).

     

     

     

  • Avatar
    Eduard Drehner

    I wrote a PunBB extension for this:

    http://k0nsl.org/blog/punbb-incapsula-extension/

    Best wishes,

    -k0nsl

  • Avatar
    Nate Nguyen

    Worked great in osCommerce - my site: http://www.meoestore.com

    1. uploading the incapsula.php file to ../public_html/includes/

    2. Modify the application_top.php ( ../public_html/includes/application_top.php)

    FIND:

      require(DIR_WS_FUNCTIONS . 'compatibility.php');

    ADD AFTER:

    require_once(DIR_FS_CATALOG . 'includes/incapsula.php');

  • Avatar
    Yoav1987

    Did that script will work for PHPBB3?

  • Avatar
    Eduard Drehner

    Yes, if implemented correctly, it'll work.

     

    Regards,

    -k0nsl

  • Avatar
    Yoav1987

    How can I do? I don't how to integrate it and where. 

  • Avatar
    Eduard Drehner

    Yoav1987,

    Hold on a couple of minutes and I'll wrap it up for you.

    Best wishes,

    -k0nsl

  • Avatar
    Eduard Drehner

    Yoav1987,

    Okay, done. Can you test this and report back:

    https://github.com/k0nsl/phpbb3-incapsula-hook

    Best wishes,

    -k0nsl

  • Avatar
    Yoav1987

    Great! It seems to work fine. 

  • Avatar
    Eduard Drehner

    Very good, Yoav1987. Have a good day!

    Regards,

    -k0nsl

  • Avatar
    Yoav1987

    Thank you for the help you give for the other webmasters :-)

  • Avatar
    pfc1775

    I just tried to install the hook for phpbb and it loaded the actual hook info into the web page. So its not working. Is there a fix for this?

  • Avatar
    pfc1775

    k0nsl are you still around?  Really hoping to get that hook working.

Powered by Zendesk