pella logo
Temperatur i Norrköping just nu:
Click for Norrköping, Sweden Forecast

Show sourcecode

The following files exists in this folder. Click to view.

public_html/incl/test/

aside.php
default.php
kmom02_pagestyle.php
kmom02_pagestyle.php~
kmom03_create_password.php
kmom03_get.php
kmom03_get.php~
kmom03_getform.php
kmom03_getform.php~
kmom03_postform.php
kmom03_postform.php~
kmom03_server.php
kmom03_session.php
kmom03_sessionchange.php
kmom03_sessiondestroy.php
kmom03_sessioninfo.php
kmom03_validate.php
kmom03_validate.php~

kmom03_validate.php~

68 lines UTF-8 Windows (CRLF)
<?php 
include("incl/config.php"); 
$title="Validera inkommande argument";
?>

<div id="content">
  <article class="border" style="width:70%;">
  <h1>Validera inkommande</h1>
   <form method="post" action="?p=kmom03-validate">
    <fieldset>
    <legend>Exempel på formulär med get-metoden</legend>
    <p>
    <label for="input1">Användarkonto:</label><br>
    <input id="input1" class="text" type="text" name="account">
    </p>
    <p>
    <label for="input2">Lösenord:</label><br>
    <input id="input2" class="text" type="password" name="password">
    </p>
    <p>
    <input type="submit" name="doLogin" value="Login">
    </p>
    </fieldset>
   </form>
<p>Du anropade sidan med följande querystring:
    <code><?php echo htmlentities($_SERVER['QUERY_STRING']); ?></code></p>
    <p><code>$_GET</code> innehåller följande:</p>
    <pre><?php print_r($_GET); ?></pre>
    
    <p><code>$_POST</code> innehåller följande:</p>
<pre><?php print_r($_POST); ?></pre>

<?php
if(isset($_POST['account'])) 
{
  echo 
"<p>Kontot är definerat.</p>";
  
  if(empty(
$_POST['account'])) 
  {
    echo 
"<p>Kontot är tomt.</p>";
  } 
  else 
  {
    if(
is_numeric($_POST['account'])) 
    {
      echo 
"<p>Kontot består enbart av numeriska tecken.</p>";
    } 
    else 
    {
      echo 
"<p>Kontot består EJ av enbart numeriska tecken.</p>";
    }    
    echo 
"<p>Med strip_tags ser kontot ut: '" strip_tags($_POST['account']) . "'</p>";
  }

else 
{
  echo 
"<p>Kontot är EJ definerat.</p>";
}
?>
    
    <hr>
  </article>
</div>