Login   Register  
PHP Classes
elePHPant
Icontem

File: FormExample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Max Nowack  >  Track Loaded Files  >  FormExample.php  >  Download  
File: FormExample.php
Role: Example script
Content type: text/plain
Description: a example form
Class: Track Loaded Files
Track and verify if page files were loaded
Author: By
Last change: changed "proof" to "track"
Date: 2 years ago
Size: 1,560 bytes
 

Contents

Class file image Download
<?php
/*******************************************
 * Author: Max Nowack                      *
 * Website: www.dasnov.de                  *
 * Classname: TrackLoadedFiles             *
 *******************************************
 * Description:                            *
 * The class track which files are loaded  *
 * from the client. With this class your   *
 * can make forms or sites securer.        *
 * Example:                                *
 * The client must load all external files *
 * they liked in the script (stylesheets,  *
 * images, etc.). Otherwise the next site  *
 * will not open.                          *
 *******************************************/
 
require("TrackLoadedFiles.class.php");
$plf = new TrackLoadedFiles("openFile.php?file=","./");
?>
<html>
    <head>
        <title>TrackLoadedFiles FormExample</title>
        <link href="<?php echo $plf->showLinkTo("main.css"); /* the function "showLinkTo()" is required to make the script working */ ?>" rel="stylesheet" type="text/css" />
    </head>
    <body>
    Test test test<br />
    <?php
        
if(isset($_POST['textfield']) && $plf->track()) // the function "track()" track if the files are loaded
        
{
            echo 
$_POST['textfield'];
        }
        else
        {
            echo 
"<img src=\"".$plf->showLinkTo("testimg.png")."\" alt=\"Test Image\" /><br />";
            echo 
"<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
            echo 
"<input type=\"text\" name=\"textfield\" />";
            echo 
"<input type=\"submit\" value=\"Send\" />";
            echo 
"</form>";
        }
    
?>
    </body>
</html>