Original post is here: eklausmeier.goip.de
Sometimes you want to store a simple text, like an URL, in a Citrix environment, which has copy-to clipboard functionality disabled. It would be handy if you could just copy the clipboard entry to another Citrix environment. I googled for "web clipboard". The listed solutions did not work. Below short PHP program solves this problem.
1<html>
2<title>Web clipboard</title>
3<body>
4
5<?php
6 $fn = "/tmp/clb.txt";
7 $maxlen = 4096;
8 if ($_SERVER['REQUEST_METHOD'] === 'POST')
9 file_put_contents($fn,substr($_POST['clb'],0,$maxlen));
10?>
11
12<form enctype="multipart/form-data" name=clb method=post action=clb.php>
13 <textarea id=clb name=clb rows=12 cols=120 maxlength=<?=$maxlen?> autofocus placeholder="Enter text"><?= file_get_contents($fn) ?></textarea>
14 <br><br>
15 <input type=Submit value="Submit">
16</form>
17
18</body>
19</html>
The "clipboard"-content is simply stored in a file on the web-server end. The size is arbitrarily limited to 4096 bytes. Initially the file is empty, and just keeps whatever is stored previously.
This solution is not well suited, when multiple people need this functionality simultaneously.