File: D:/web/hyperflight/~clip/index.asp
<%Option Explicit%>
<!--#include virtual="/dbfunctions.asp"-->
<!--#include virtual="/apputils.asp"-->
<%DisableCache%>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<meta charset="windows-1252">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Clipboard</title>
<!--<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="/common/jquery/jquery-3.6.3.min.js"></script>
<!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
<link href="/common/fontawesome/css/fontawesome.css" rel="stylesheet">
<link href="/common/fontawesome/css/brands.css" rel="stylesheet">
<link href="/common/fontawesome/css/solid.css" rel="stylesheet">
<link href="/common/fontawesome/css/sharp-regular.css" rel="stylesheet">
<link href="/common/fontawesome/css/duotone.css" rel="stylesheet">
</head>
<body>
<%
' (SS,01/03/2023) first version of ~clip (Clipboard)
Dim LIP, LCookie
Const TAB_ACCESS_COOKIE_VALUE = "t!L^:SZ+6IoK"
LIP = Request.ServerVariables("REMOTE_ADDR")
LCookie = GetCookie("TabAccess")
' (SS,26/1/22) added 5.101.172.199 to test on ITP server and show detailed error info
If LIP = "192.168.1.2" Or LIP = "88.98.246.98" Or LIP = "80.229.231.82" Or LIP = "86.10.87.170" Or LIP = "5.101.172.199" Or LCookie = TAB_ACCESS_COOKIE_VALUE Then
If LCookie = "" Then SetCookie "TabAccess", TAB_ACCESS_COOKIE_VALUE
If Request("submit") = "save" Then
SaveClipboard Request("clipboard")
' redirect to home page
Response.Redirect "."
End If
ShowClipboard
Else
Response.Write "No access for IP: " & LIP & BR & NL
End If
%>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</body>
</html>
<%
Sub ShowClipboard
Dim LClipboard
LClipboard = NB(GetSettingMemo("Scratch", "Clipboard"))
%>
<div class="text-center">
<form method="post">
<div class="mt-2">
<button type="submit" name="submit" value="load" class="btn btn-primary mx-2 mb-3"><i class="fa-duotone fa-cloud-arrow-down"></i> Load</button>
<span class="display-6"><i class="fa-duotone fa-clipboard"></i> Clipboard</span>
<!--<button type="submit" name="submit" value="save" id="itpSubmit" class="btn btn-primary mx-2 mb-3" disabled>Save <i class="fa-duotone fa-cloud-arrow-up"></i></button>-->
</div>
<div class="mx-3">
<textarea class="form-control" id="itpClipboard" style="height: 90%" name="clipboard"><%=HTMLEncode(LClipboard)%></textarea>
</div>
</form>
<script>
$(function () {
$("#itpClipboard").on('change keyup paste', function() {
//Reference the Button.
// var btnSubmit = $("#itpSubmit");
// btnSubmit.removeAttr("disabled");
// (SS,2/3/23) save using ajax
//var itpClipboard = 'ajax clipboard test';
var itpClipboard = $('textarea#itpClipboard').val();
$.post('ajax.asp',
{
cmd: "save",
clipboard: itpClipboard
},
function(data, status) {
// $("#ajax-info").html(data);
}
);
});
});
</script>
</div>
<%
End Sub
' make sure this setting exists, otherwise it won't be updated
Sub SaveClipboard(AClipboard)
SetSettingMemo "Scratch", "Clipboard", AClipboard
End Sub
' (SS,1/3/23) save value in memo field, to be made into a dbfunctions routine, may need to make it unicode/utf8?
Sub SetSettingMemo(AGroupName, AFieldName, AFieldValue)
DebugLog 1, "SetSettingMemo called with " & AGroupName & ", " & AFieldName
SQLExecute "SetSettingMemo", "UPDATE settings SET MemoValue = '" & CleanSQLStr(AFieldValue) & "' WHERE GroupName = '" & AGroupName & "' AND FieldName = '" & AFieldName & "'"
End Sub
%>