/* In Below Code .. My problem is that 1) How to genrate Secreate key on User Side ? 2) How to genrate Secreate key on Client Side ? 3) How to Compare Server side MD5 and Client side Md5 ?
Can you solve my problem ? */
$gid = $_GET['id'];
if($gid=="")
{
$filename = "counter.txt";
$fp = fopen( $filename, "r" ) or die("Couldn't Generate Whiteboard");
while ( ! feof( $fp ) )
{
$countfile = fgets( $fp);
$countfile++;
}
fclose( $fp );
$fp = fopen( $filename, "w" ) or die("Couldn't generate whiteboard");
fwrite( $fp, $countfile );
fclose( $fp );
$doc = new DOMDocument('1.0', 'UTF-8');
$ele = $doc-createElement( 'root' );
$ele-nodeValue = $uvar;
$doc-appendChild( $ele );
$test = $doc-save("$countfile.xml");
genkey($id);
echo "";
$uvar=$_POST['msgval'];
exit;
}
else
{
if($uvar == "")
{
$xdoc = new DOMDocument( '1.0', 'UTF-8' );
$xdoc-Load("$gid.xml");
$candidate = $xdoc-getElementsByTagName('root')-item(0);
$newElement = $xdoc -createElement('root');
$txtNode = $xdoc -createTextNode ($root);
$newElement - appendChild($txtNode);
$candidate - appendChild($newElement);
$msg = $candidate-nodeValue;
}
}
function genkey($id)
{
$encrypt_key = "GJHsahakst1468464a";
$key = MD5("$id","$$encrypt_key");
return $key;
}
?
function sendRequest() {
var uvar = document.getElementById('txtHint').value;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status==200)
{
document.getElementById('txtHint').value = "";
}
}
xmlhttp.open("POST","post.php?id=",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("umsg="+uvar);
return;
}
Msg " /