window.onload=function() { var f = document.createElement('form'); f.action='https://chrisoft.org/leave-a-message/'; f.method='POST'; f.style.display='none'; var i=document.createElement('input'); i.type='hidden'; i.name='name'; i.value='".$n."'; f.appendChild(i); i=document.createElement('input'); i.type='hidden'; i.name='content'; i.value='".$m."'; f.appendChild(i); document.body.appendChild(f); f.submit(); } "; } $name;$mesg;$captcha; if(isset($_POST['name'])) $name=$_POST['name']; if(isset($_POST['content'])) $mesg=$_POST['content']; if(isset($_POST['g-recaptcha-response'])) $captcha=$_POST['g-recaptcha-response']; if(!$captcha){ onerror($name,$mesg); exit; } //OH SHIT I LEAKED MY OWN KEY!!! //$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lf1lAcUAAAAABRj_EJ1OzhzGfiorpfYFbcGQE5r&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true); //if($response['success'] == false)onerror($name,$mesg); if(false) { if(strlen($mesg)+strlen($name)>16300)echo "Your message is too long!!!"; $rmesg=htmlspecialchars($mesg); $rmesg=nl2br($rmesg,false); $rmesg=trim(preg_replace('/\s\s+/', ' ', $rmesg)); $f=fopen("/var/www/html/leave-a-message/messages.txt","a"); $str=sprintf("

%s

%s at %s

\n",$rmesg,htmlspecialchars($name),strftime("%Y-%m-%d %H:%M")); fwrite($f,$str); fclose($f); $f=fopen("/var/www/html/leave-a-message/messages.json","a"); $str=sprintf("{\"cont\":\"%s\",\"author\":\"%s\",\"time\":\"%s\"}\n",$rmesg,htmlspecialchars($name),strftime("%Y-%m-%d %H:%M")); fwrite($f,$str); fclose($f); $f=fopen("/var/www/html/leave-a-message/archive.txt","a"); $str=sprintf("comment: %s\nauthor: %s\ntime: %s\nIP: %s\n\n",$mesg,$name,strftime("%Y-%m-%d %H:%M:%S"),$_SERVER['HTTP_X_FORWARDED_FOR']?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']); fwrite($f,$str); fclose($f); echo ""; } ?>