PHP Classes

File: client_form.php

Recommend this page to a friend!
  Classes of Er. Rochak Chauhan   PHP Encode Form Values   client_form.php   Download  
File: client_form.php
Role: Example script
Content type: text/plain
Description: client script
Class: PHP Encode Form Values
Decode base64 encoded submitted form values
Author: By
Last change:
Date: 9 years ago
Size: 1,873 bytes
 

Contents

Class file image Download
<html>
    <head>
        <title>Demo :: Encode Form content</title>
    </head>
    <body>
        <h1>Demo :: Encode Form content</h1>
        <h3>Demo #1 (HTML Post)</h3>
        <script type="text/javascript">
            var secret="#_ZII_#";
           
            <?php
               
require("PhpEncodeFormContents.inc.php");
               
$obj=new PhpEncodeFormContents("#_ZII_#");
                echo
$obj->getBase64encodeJavascriptFunctions();
               
           
?>

            function encForm1(){
                ob('uname1');
                ob('passwd1');
            }
            function encForm2(){
                ob('uname2');
                ob('passwd2');
                $$$('demo2').submit();
            }
            function $$$(i){
                return document.getElementById(i);
            }
            function ob(i){
                var val=$$$(i).value;
                val=secret+val+secret;
                var encrypted = Base64.encode(val);
                $$$(i).value=encrypted;
            }
        </script>
        <form method="post" action="server_post.php" >
            <p><strong>Username: </strong> <input type="text" id="uname1" name="uname" /></p>
            <p><strong>Password: </strong> <input type="password" id="passwd1" name="passwd" /></p>
            <p><input type="submit" value="Demo 1" onclick="encForm1();" /></p>
        </form>
        <hr />
        <h3>Demo #2 (JS Post)</h3>
        <form method="post" action="server_post.php" id="demo2">
            <p><strong>Username: </strong> <input type="text" id="uname2" name="uname" /></p>
            <p><strong>Password: </strong> <input type="password" id="passwd2" name="passwd" /></p>
            <p><input type="button" value="Demo 2" onclick="encForm2();" /></p>
        </form>
    </body>
</html>