V
V
Victor Savelyev2018-02-08 11:56:37
htaccess
Victor Savelyev, 2018-02-08 11:56:37

How to get POST variables if they are created in the admin folder?

Hello there is a post like this

RewriteEngine On
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_METHOD} ^POST$
RewriteRule .*? index.php [L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

It was created to receive POST variables to the index. I have created an admin folder to create site management pages.
Help me rewrite the code so that if POST variables are created in the admin folder, they can get there. You can also in the index.php file

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kim, 2018-02-08
@kimono

$_POSTdata can be obtained from the script to which they are sent.
Roughly speaking, if you specified:

<form action="index.php" method="POST">
  <!-- -->
</form>

then in the file index.phpyou will get this data from the form, and if:
<form action="admin/index.php" method="POST">
  <!-- -->
</form>

then catch them inadmin/index.php

V
Viktor Savelyev, 2018-02-08
@sobesednict

Dmitry is not so simple. I had to create such a design because the index.php file loads other files into itself to display pages, as a result, the variables tried to be transferred to those files that it loads into itself. So that I can catch them, I found this code. And it turns out now, when creating the POST site admin panel, the variables are trying to be transferred to the head index file, and I need them to get into the adm folder index file
There is one more solution. Is it possible to password protect only one file? That is, using this file, write protection, say, on the admin.php file, in this case I can try to catch POST values.
No, this method did not help. Although when calling this file on the site, it substitutes the values ​​of the index file and then the insides of the called one. But the admin file is called and the data is not included in this call.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question