Browse Source

Include php files for the repo.

dettanym 4 years ago
parent
commit
239a532e69
2 changed files with 64 additions and 0 deletions
  1. 38 0
      action.php
  2. 26 0
      index.php

+ 38 - 0
action.php

@@ -0,0 +1,38 @@
+<html><body>
+<?php
+
+        $client_pub_key_b64=""; // Invalid base64
+        $client_pub_key_header="Mitigator-Client-Public-Key";
+        $headers=getallheaders(); // TODO: Error-checking: could be null - treat same way as if header n$
+        if(array_key_exists($client_pub_key_header, $headers))
+        {
+                $client_pub_key_b64=$headers[$client_pub_key_header];
+        }
+        else if(array_key_exists(strtolower( $client_pub_key_header), $headers)) // TODO: NASTY BUG HERE$
+        {
+                $client_pub_key_b64=$headers[ strtolower( $client_pub_key_header ) ];
+        }
+	// echo $client_pub_key_b64;
+        $ip_args = array($client_pub_key_b64);
+        if ($_SERVER["REQUEST_METHOD"] === "POST") {
+                foreach ($_POST as $key => $value) {
+                        array_push($ip_args, $value);
+			// print_r( $ip_args );
+                }
+        }
+        $ret_obj = php_decrypt_wrapper($ip_args);
+        $is_success = $ret_obj->success;
+        if($is_success === "true")
+        {
+                $fields = $ret_obj->fields;
+                $no_of_fields=count($fields);
+		foreach ($fields as $key => $value) {
+                        echo $value . " ";
+                }
+        }
+        else
+                echo "Could not decrypt.";
+
+?>
+</body></html>
+

+ 26 - 0
index.php

@@ -0,0 +1,26 @@
+<html>
+<?php
+	echo "Hello World";
+	if( extension_loaded("decryptor_la_setup_and_decryption"))
+	{
+		echo "extension is loaded.";
+	        $obj2=get_mitigator_header();
+        	echo $obj2;
+	        header($obj2);
+	}
+	else
+		echo "extension is not loaded.";
+
+?>
+<body>
+	<form action="action.php" method="post" id="form">
+		<p>Your name: <input type="text" name="name" id="name"/></p>
+		<p>Your age: <input type="text" name="age" id="age" /></p>
+		<p><input type="submit" name="submitButton" id="submitButton"  /></p>
+	</form>
+	<button id="experimenter1Button"> experimenter 1 </button>
+        <button id="experimenter2Button"> experimenter 2 </button>
+
+</body>
+</html>
+