<html>
<head>
<!--
jsRequestChat v0.1 - Chat room executable on common server types.
Copyright (C) 2012 Riley Galloway
This file is part of jsRequestChat.
jsRequestChat is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with jsRequestChat. If not, see <http://www.gnu.org/licenses/>.
You can contact the author at hide@address.com
-->
<title>jsRequestChat v.1</title>
<script type="text/javascript">
var hostpath = "http://example.com/"; //End slash required - "http://example.com/exampledir/"
var message = "";
var newname = "";
var txtFile = new XMLHttpRequest();
var save = new XMLHttpRequest();
var msgs = document.getElementById("msgs");
var msg_txt = document.getElementById("msg_txt");
var nameval = document.getElementById("nameval");
var chars = "abcdefghijklmnopqrstuvwxyz";
var string_length = 4;
var randomstring = '';
for (var i = 0; i < string_length; i++)
{
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum, rnum + 1);
}
var rName = randomstring;
function sendmessage(message)
{
if (message != "")
{
message = hms() + rName + ": " + message;
var save = new XMLHttpRequest();
save.open("GET", hostpath + "update.php?message=" + message, true);
save.onreadystatechange = function ()
{
if (save.readyState == 4)
{
if (save.status == 200)
{}
}
}
save.send(null);
msg_txt.value = "";
}
}
function hms()
{
var today = new Date();
var h = checktime(today.getHours());
var m = checktime(today.getMinutes());
var s = checktime(today.getSeconds());
var t_hms = h + ":" + m + ":" + s;
return "[" + t_hms + "]";
}
function checktime(i)
{
if (i < 10)
{
i = "0" + i;
}
return i;
}
function updateName()
{
newname = prompt('Enter a new name: (Max. of 12 chars)', rName);
checkName();
message = hms() + rName + " changed username to " + newname;
var save = new XMLHttpRequest();
save.open("GET", hostpath + "update.php?message=" + message, true);
save.onreadystatechange = function ()
{
if (save.readyState == 4)
{
if (save.status == 200)
{}
}
}
save.send(null);
rName = newname;
nameval.innerHTML = rName;
}
function checkName()
{
if (newname.length > 12)
{
newname = newname.substring(0, 12);
}
if (newname.toUpperCase() == "SERVER")
{
newname = "nicetry";
}
}
function startFunc()
{
setInterval(function ()
{
update()
}, 1000);
}
function update()
{
var txtFile = new XMLHttpRequest();
txtFile.open("GET", hostpath + "chat.crack", true);
txtFile.onreadystatechange = function ()
{
if (txtFile.readyState == 4)
{
if (txtFile.status == 200)
{
var allText = txtFile.responseText;
msgs.innerHTML = allText;
}
}
}
txtFile.send(null);
}
function connected()
{
message = hms() + rName + " has connected...";
var save = new XMLHttpRequest();
save.open("GET", hostpath + "update.php?message=" + message, true);
save.onreadystatechange = function ()
{
if (save.readyState == 4)
{
if (save.status == 200)
{
console.log(save.responseText);
}
}
}
save.send(null);
}
function showgpu()
{
gpu.innerHTML = "<br /><code>jsRequestChat v.1 Copyright (C) 2012 Riley Galloway<br />This program comes with ABSOLUTELY NO WARRANTY<br />This is free software, and you are welcome to redistribute it under certain conditions.<br /><a href='http://www.gnu.org/licenses/gpl-3.0.txt'>View License</a></code>";
}
</script>
<style type="text/css">
body {
background-color:gray;
}
div.app {
background-color:black;
width:500px;
border:3px solid gray;
color:white;
font-family:Arial;
}
button {
color:black;
border:1px solid white;
}
input {
background-color:black;
font-family:courier new;
color:rgb(0, 255, 0);
border:1px solid gray;
width:450;
}
textarea.msgs {
background-color:black;
color:rgb(0, 255, 0);
font-family:courier new;
border:1px solid gray;
width:500px;
height:500px;
}
</style>
</head>
<body onload="connected();">
<center>
<h1>jsRequestChat v.1</h1>
<div class="app">Chat Room - Welcome
<font id="nameval"></font>
<button type="button" onclick="updateName();">Change Name</button>
<textarea id="msgs" class="msgs" readonly="readonly">Connecting to server...</textarea>
<input type="text" id="msg_txt" maxLength="300" class="msg_txt" onkeydown="if (event.keyCode == 13) sendmessage(msg_txt.value);" />
<button type="button" onclick="sendmessage(msg_txt.value);">Send</button>
<br />
</div>
<img src="http://www.gnu.org/graphics/gplv3-88x31.png" onclick="showgpu();" />
<font id="gpu"></font>
<br />
jsRequestChat v.1 - Chat room executable on common server types.
<br />
Copyright (C) 2012 Riley Galloway
</center>
</body>
<script type="text/javascript">
var msgs = document.getElementById("msgs");
var msg_txt = document.getElementById("msg_txt");
var nameval = document.getElementById("nameval");
var gpu = document.getElementById("gpu");
nameval.innerHTML = rName;
startFunc();
</script>
</html>