I have my own PHP pages that run in the same directory as the CS-Cart shop. With the help of CURL requests I use the CS-Cart API to create vendors. Everything works fine: on page x1.php the user makes several form entries. Page x2.php receives the form post and calls (amongst other things) the CS-Cart API.
But after activating the add-on "Access restrictions", the curl request is rejected with the error message that I am not authorized to enter this area.
Okay, I thought I just need to add the server's IP address (Administration > Access restrictions > administration panel).
I made the following entries:
- external IP of the server ($_SERVER['SERVER_ADDR'])
- internal IP of the server
- 127.0.0.1 (localhost)
None of the entries work.The PHP page (more precisely: the CURL post) is still rejected.
Does anyone know which entry would be the right one?
Post your curl request... If you're using the API, it should setup the proper environment if it authtenicates properly. If you're using the admin environment and not properly setting up the $_SESSION['auth'] then you will get those type of failures.
Now I'm totally confused. Activating and deactivating the add-on makes it work somehow (although I had tried this several times before). It completely depends on the existence of the IP entry "Server itself" (=public IP of the server).
Behaviour before was:
It is the same error message the add-on "access restrictions" throws (e.g. when an admin tries to open the admin.php although he is not on the IP white list).
The error message (in variable $server_output) is: "Es ist Ihnen nicht erlaubt diesen Bereich zu betreten". This is german and means "You are not allowed to enter this area". HTTP code is 200.
What I generally don't understand yet: how can I access the CS-Cart environment such as session variables, functions etc.?