After user registration, website send activation code to email. something like that. www.domain.com/?activate=<code>
I'm creating 2 variants of activation: 1.manual 2.auto Lets say we have index.php.
1.Manual method. When someone wants to activate user manually all things are obvious:
User opens page www.domain.com/?activate
Index.php
checks with following script and includes div file (which contains activation form)
if (isset($_GET['activate'])) {
$page='activate';
$divfile = 'path to div.php';
}
include $divfile;
Then page sends form data via ajax to activation.php
file.
2.Auto method. Let's say user clicked directly to www.domain.com/?activate=<code>
. What I want to do is, to check if(!empty($_GET['activate']))
, if all right. I can't figure out what to do. Programmatically send something like POST to activation.php
or what?
Normally, you would call the required function from index.php. You wouldn't post anything.
Look at include and include_once.
You should encapsulate your activation code into a separate php file that acts as your function library. Create an activate() method that does the activation in a file called activate.php.
Then, from both activation.php and index.php, you do something like this:
include 'activate.php';
// Call the activate function from activate.php
activate($code);
However, you don't Post to call other code. You simply call it from PHP.