summaryrefslogtreecommitdiff
path: root/leave-a-message/index.php
blob: 3589515157ecd9c473d9c13e9c81bba12b5a8862 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="expires" content="Friday 24 October 1997 09:30 GMT">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Chrisoft::Leave a message</title>
	<link rel=stylesheet href='../common.css' type='text/css'>
	<link rel=stylesheet href='extras.css' type='text/css'>
	<style type="text/css">
		div.comment{
			border:1px solid #CCC;
		}
		div.author{
			text-align:right;
		}
	</style>
	<script src='https://www.google.com/recaptcha/api.js'></script>
	<script type="text/javascript">
		function verify()
		{
			if(document.getElementById("content").value.length+document.getElementById("name").value.length>16300)return;
			try
			{
				if(grecaptcha.getResponse().length===0)
				document.getElementById("ann").style.display="inline-block";
				else document.getElementById("msgform").submit();
			}
			catch(e){return;}
		}
		function ol()
		{
		if( navigator.userAgent.match(/Android/i)
		 || navigator.userAgent.match(/webOS/i)
		 || navigator.userAgent.match(/iPhone/i)
		 || navigator.userAgent.match(/iPad/i)
		 || navigator.userAgent.match(/iPod/i)
		 || navigator.userAgent.match(/BlackBerry/i)
		 || navigator.userAgent.match(/Windows Phone/i)
		 )
			document.getElementById("tab").style.width="98%",
			document.getElementById("msgform").style.width="96%";
		}
	</script>
	<?php
		if(isset($_POST['name']))
		echo "<script>
		window.onload=function()
		{
			document.getElementById(\"ann\").style.display=\"inline-block\";
			document.getElementById(\"name\").value=\"".$_POST['name']."\";
			document.getElementById(\"content\").value=\"".$_POST['content']."\";
		}
		</script>";
	?>
</head>
<body onload="ol()">
<table id="tab" border="0" style="width:70%;margin:auto;">
	<tr>
		<td class="CTitle" style="font-size:2em;">
			<a href="../">Chrisoft</a>::Messages
		</td>
	</tr>
	<tr><td>
		<h1 class="TText">Deprecated. Use Guestbook found in the homepage instead.</h1>
		<div class="TText" style="margin:auto;width:80%">
		<?php
			$file=fopen("/var/www/html/leave-a-message/messages.txt","r");
			$comms;$i=0;
			while(($str=fgets($file,16384))!==false)$comms[$i++]=$str;
			fclose($file);
			while(--$i>=0)echo $comms[$i];
		?>
		<form action="writemessage.php" id="msgform" method="post" style="width:50%;margin:auto;padding:5px;border:1px solid #CCC;">
		<span style="width:90%;display:table;">
		<label for="name" style="display:table-cell;width:1px;white-space:nowrap;">Your honourable name:</label>
		<input type="text" id="name" name="name" required style="margin-left:5px;display:table-cell;width:100%;">
		</span>
		<p>Message:</p>
		<textarea required id="content" name="content" rows="5" style="width:90%;margin-left:1px;"></textarea>
		<p>
		Something Annoying: <span id="ann" style="color:#F00;display:none;">Please complete the annoying challenge!</span></p>
		<div class="g-recaptcha" data-sitekey="6Lf1lAcUAAAAAGep8SpTETdIrEiw6w8uVy8IXp9U"></div><br>
		<div style="text-align:center;">
		<button onclick="verify();" type="button" style="border:none;color:white;padding:0.5em 2em;text-align:center;background-color:#44AA44;-webkit-transition-duration:0.4s;transition-duration:0.4s;">Leave the message!</button>
		</div>
		</form>
		</div>
	</td></tr>
</table>
</body>