title: How to call a PHP function itself?
body: <p>I have a file called "login.php". It's a little bit of PHP, which I found on the internet, and a login form. When the login button is fired, then the PHP should check the inputs wether they're valid or invalid. </p>
  
  <p>I have solved this by redirecting to the actual file, so that it's refreshing the page. But this doens't work in wordpress, so I want to redirect to the actual PHP function.</p>
  
  <p>My code looks like this: </p>
  
  <pre><code>&lt;?php
       if ($_SERVER['REQUEST_METHOD'] == 'POST') {
       session_start();
  
       $username = $_POST['username'];
       $passwort = $_POST['passwort'];
  
       $hostname = $_SERVER['HTTP_HOST'];
       $path = dirname($_SERVER['PHP_SELF']);
  
       // Benutzername und Passwort werden überprüft
       if ($username == 'admin' &amp;&amp; $passwort == 'admin') {
          $_SESSION['angemeldet'] = true;
  
              // Weiterleitung zur geschützten Startseite
              if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
                  if (php_sapi_name() == 'cgi') {
                      header('Status: 303 See Other');
                  }
                  else {
                      header('HTTP/1.1 303 See Other');
                  }
              }
  
         header('downloadbereich.php');
         exit;
         }
        }
  ?&gt;
  
  &lt;link href="login.css" rel="stylesheet" type="text/css" /&gt;
  &lt;div class="contactForm" id="contactForm" style="width: 500px; margin: auto; float: left;"&gt;
  
  &lt;!--start contact form --&gt;
  
  &lt;form name="myform" method="post" action="login.php&lt;!-- this is what I want to remove--&gt;"&gt;
      &lt;p class="form" style="width: 245px; height: 116px; margin-right: 10px;"&gt;&lt;input class="field" type="text" name="username" placeholder="Name" /&gt;
      &lt;input class="field" type="password" autofocus name="passwort" placeholder="Passwort" /&gt;
      &lt;button class="button" name="Submit"&gt;Login&lt;/button&gt;&lt;/p&gt;
  
  &lt;/form&gt;&lt;/div&gt;
  </code></pre>