Location: PHPKode > scripts > Transcrypt > transcrypt/src/index.php
<?php
/************************************************************************************
*  Copyright notice
* 
*  Transcrypt
*
*  Copyright (C) 2000-2005 CH Software (hide@address.com)
*  www.chsoftware.net
*  All rights reserved
*  For more information go to: 
*  www.chsoftware.net/en/useware/conditions/conditions.htm
*
*
*
*  This program is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*  The GNU General Public License can be found at
*  http://www.gnu.org/licenses/gpl.html
*  A copy is found in the textfile GPL.txt and important notices to the license
*  from the author is found in LICENSE.txt distributed with these scripts. 
*
*************************************************************************************/


/**
 * Main file of TransCrypt
 *
 * Revised on 21.9.2004 by Cornelius Herzog
 *
 * @author	Cornelius Herzog (hide@address.com)
 */ 

include("class.arc4.inc.php");		//including the arc4 class
//encoding of the content
$arc4 = new ARC4;						//initialize new class
$arc4->strKey = "";						//here put in the password
$arc4->strText = '';					//the content that has to be encoded
$arc4->Encode();						//encode it!
?>
<!-- Copyright (c) 2000-2004 CH Software (www.chsoftware.net) -->
<!-- Distrubuted under the Usewareconditions (www.chsoftware.net/index.php?p=usewareconditions) -->
<!-- This three lines must stay intact and may no be touched-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<!--Make sure that this page is not cached in any browser-->
	<meta http-equiv="expires" content="0"> 
	<meta name="robots" content="noindex">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="pragma" content="no-cache">
	<script language="JavaScript" type="text/javascript" src="arc4.js">
	<!--
	/*Include the arc4 javascript class */
	-->
	</script>
	<script language="JavaScript" type="text/javascript" src="md5.js">
	<!--
	/*Include the md5 javascript class */
	-->
	</script>
	<script language="JavaScript" type="text/javascript">
	<!--
	/* This function handles the decryption of the content!*/
	function showContent() {
		var cnt = "<?php echo $arc4->result; ?>";	//here the content is put in by php
		var pwhash = "<?php echo $arc4->pwhash; ?>"; //here the hash of the password is put in by php
		var pw = document.getElementById("password").value; //get the password from the password field
		var newhash = MD5(pw);								//create the hash of the inputed pw
		if(newhash == pwhash) {								//if the hash checks doesnt fail,...
			var decnt = (new ARc4B64Class()).Decrypt(cnt,pw);    //decrypt the content...
			document.close();									//close the actual document
			document.open();									//open a new one
			document.write(decnt);								//write the content
			document.close();									//close the content
		}else{													//otherwise...
			document.getElementById("errormsg").style.visibility = "visible";		//make the errormsg visible
		}
	}
	-->
	</script>
	<script type="text/javascript">
		<!--
		
		function windowWidth()						//this function justs controlls the window width
		{
		 if (window.innerWidth) return window.innerWidth;
		 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
		 else return 0;
		}
		
		function windowHeight()						//this function justs controlls the window height
		{
		 if (window.innerHeight) return window.innerHeight;
		 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
		 else return 0;
		}
		
		
		function reBuild()							//this functions rebuilds the positions of the divboxes, if the windowsize is changed
		{
		 if (wWidth != windowWidth() || wHeight != windowHeight())
		 setPosition();
		}
		
		/*Initialize surveillance of Netscape */
		if(!window.wWidth && window.innerWidth)
		  {
		   window.onresize = reBuild;
		   wWidth = windowWidth();
		   wHeight = windowHeight();
		  }
		
		//-->
</script>

</head>
<body>
<!-- DIV Box for the pw input -->
<div id="inputpw" style="visibility: visible; position:absolute; width:200px; height:100px; border: 3px dashed navy; align:center; background-color:silver;padding-top:10px;">
<div align="center" style="font-family:Verdana; font-size:11px;">Password:<input type="password" name="password" id="password"><br><br>
<input type="button" onclick="showContent()" name="go" value="Anzeigen >>">
</div>
</div>
<!-- DIV Box for the errormsg -->
<div id="errormsg" style="visibility: hidden; position:absolute; width:200px; height:100px; border: 3px dashed navy; align:center; background-color:red;padding-top:10px;">
<div align="center" style="font-family:verdana, arial; font-size:11px;">
Wrong password!<br>
<a href="javascript:;" onclick="document.getElementById('errormsg').style.visibility = 'hidden';document.getElementById('password').value = '';">Back</a>
</div>
</div>
<!-- DIV Box for the Copyright notice. May not be removed -->
<div id="copyright" align="center" style="position:absolute; width:300px; font-family:verdana; font-size:10px;">Copyright &copy; CH Software 2004 (<a href="http://www.chsoftware.net">www.chsoftware.net</a>)</div>
<!-- This javascript functions simply set the positions of the div boxes -->
<script language="JavaScript" type="text/javascript">

function setPosition() {
	if(document.body.offsetWidth) {
		var a=document.body.offsetWidth;
	}else{
		var a=window.innerWidth;
	}
	document.getElementById("inputpw").style.left = a / 2 - 100;
	document.getElementById("errormsg").style.left = a / 2 - 100;
	document.getElementById("copyright").style.left = a / 2 -150;

	if(document.body.offsetHeight) {
		var a=document.body.offsetHeight;
	}else{
		var a=window.innerHeight;
	}
	document.getElementById("inputpw").style.top = a / 2 - 100;
	document.getElementById("errormsg").style.top = a / 2 - 100;
	document.getElementById("copyright").style.top = a - 50;
}
setPosition();
</script>
<script type="text/javascript">
<!--
 /*Initialize surveillance of MS Internet Explorer*/
 if(!window.wWidth && document.body && document.body.offsetWidth)
  {
   window.onresize = reBuild;
   wWidth = windowWidth();
   wHeight = windowHeight();
  }
//-->
</script>

</body>
</html>
Return current item: Transcrypt