Hacky: action und Formulare bei dynamischen Seiten

Moin
Ich möchte ein Script includen. Ein startet mit einem Login-teil.
Der Code:
<?php
include "stuff24_cc/config.php";

function login(){
 print "Login<br>
  <form method="get" action="index.php?site=stuff24_cc/admin">
   <table cellspacing="0" cellpadding="0">
     <tr>
    <td><input type="hidden" name="action" value="show">User</td>
    <td><input type="text" name="username"></td>
     </tr>
     <tr>
    <td>Passwort </td>
    <td><input type="password" name="password"></td>
     </tr>
     <tr>
    <td> </td>
    <td><input type="submit" value="Weiter"></td>
     </tr>
   </table>
  </form>";
}

if (($_GET[username] == "") and ($_GET[password] == "")){
 print login();
}
...usw.

Er soll jetzt per 'get' an index.php?site=stuff24_cc/admin die Daten übergeben. Tut er aber nicht. Er sendet sie nur an index.php... Wie soll ichs aber machn wenn ich das alles inncluen will??

mfg hacky

  1. Guten Morgen,

    <?php

    function login(){
    print "Login<br>

    <form method="get" action="index.php">

    <table cellspacing="0" cellpadding="0">
         <tr>
        <td><input type="hidden" name="action" value="show">User</td>
        <td><input type="text" name="username"></td>
         </tr>
         <tr>
        <td>Passwort </td>
        <td><input type="password" name="password"></td>
         </tr>
         <tr>
        <td> </td>
        <td><input type="submit" value="Weiter"></td>
         </tr>
       </table>
      </form>";
    }

    if (($_GET[username] == "") and ($_GET[password] == "")){
    print login();

    include "stuff24_cc/config.php";

    }

    elseif($_GET[username]!='' && $_GET[password]!='') include('site=stuff24_cc/admin.php');

    ...usw.

    Da Variablen von Formularen in der Methode GET an die Ziel-URI angehängt werden, kommte es automatisch zum Konflikt.
    Solltest Du dennoch so verfahren wollen, verwende stattdessen als Methode POST.

    Gruß aus Berlin!
    eddi