-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathchat.php
More file actions
81 lines (73 loc) · 2.8 KB
/
chat.php
File metadata and controls
81 lines (73 loc) · 2.8 KB
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
<?php
//** init session
session_start();
//** load config
include ('./inc/config.php');
//** check session
if (!isset ($_SESSION['ac_time']) || !isset ($_SESSION['ac_user'])) {
header("Location: $ac_dir");
exit;
}
?>
<!DOCTYPE html>
<html lang=en-GB>
<head>
<title>Atom Chat</title>
<meta charset=UTF-8 />
<meta name=language content=en-GB />
<meta name=description content="Atom Chat free PHP chat script"/>
<meta name=keywords content="Atom Chat, free PHP chat scripts"/>
<meta name=robots content="noodp, noydir"/>
<meta name=viewport content="width=device-width, height=device-height, initial-scale=1"/>
<link rel=icon href="<?php echo $ac_www . $ac_dir; ?>favicon.png" type="image/png"/>
<link rel=stylesheet href="<?php echo $ac_www . $ac_inc; ?>style.css" type="text/css"/>
</head>
<body>
<?php include ($ac_hdr); ?>
<object data="<?php echo $ac_www . $ac_chp; ?>" type="text/html">Failed to render object data!</object>
<div id=ac_menu>
<form action="<?php echo $ac_www . $ac_chf; ?>" method=POST id=ac_chat accept-charset=UTF-8>
<div id=ac_char>Text <span id=ac_count></span></div>
<div>
<textarea name=ac_text rows=4 cols=40 maxlength=256 title="Type here to enter your message" onkeyup=ac_count('ac_text');></textarea>
</div>
<div>
<input name=ac_user value=<?php echo $_SESSION['ac_user']; ?> type=hidden />
<input name=ac_quit value=Quit title="Click here to quit the current session" type=submit />
<input name=ac_save value=Save title="Click here to download and save the current session" type=submit />
<input name=ac_push value=Push title="Click here to manually update the current session" type=submit />
<input name=ac_post value=Post title="Click here to post your message" type=submit />
</div>
</form>
<?php include ($ac_ftr); ?>
</div>
<script>
//** character counter
var ac_cmax = 256;
var ac_cdiv = "ac_count";
//** init counter
document.getElementById(ac_cdiv).innerHTML = "(" + ac_cmax + ")";
//** count characters
function ac_count(ac_token, ac_counter) {
var ac_count, ac_counter, ac_form = "";
if (ac_token == "ac_text") {
ac_count = ac_cmax;
ac_counter = ac_cdiv;
ac_form = document.forms.ac_chat.ac_text.value;
} else {
alert("Invalid counter!");
}
var ac_ucount = ac_form;
var ac_ulength = ac_ucount.length;
//** check maximimum characters
if (ac_ulength > ac_count) {
ac_ucount = ac_ucount.substring(0, ac_count);
ac_form = ac_ucount;
return false;
}
//** update counter
document.getElementById(ac_counter).innerHTML = "(" + (ac_count-ac_ulength) + ")";
}
</script>
</body>
</html>