-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
244 lines (193 loc) · 6.56 KB
/
index.php
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php include 'start.php';?>
<!DOCTYPE html>
<head>
<title>Cat Room</title>
<meta charset="UTF-8">
<meta name="description" content="Cat Room a free chat rooms without registration where you can chatting and meet new people, 100% Online chat rooms for free, No download required.">
<meta name="keywords" content="chat, chat room, chat rooms,free chat,egypt chat,egyprian,egyptian chat room,egypt room">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:image" content="https://codebyus.org/cat.png" />
<link rel="icon" type="image/png" href="https://codebyus.org/cat.png">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js" ></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#dialog" ).dialog();
} );
</script>
<style>
#page-footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 40px;
padding: 0 5px;
display: flex;
align-items: center;
justify-content: center;
}
*{
margin: 0;
padding: 0;
outline: 0;
}
body {
font-family: 'Poppins', sans-serif;
}
body{
background: linear-gradient(-45deg, #3f51b1 0%, #5a55ae 13%, #7b5fac 25%, #8f6aae 38%, #a86aa4 50%, #cc6b8e 62%, #f18271 75%, #f3a469 87%, #f7c978 100%);;
background-size: 400% 400%;
animation: animate 7.5s ease-in-out infinite;
justify-content: center;
align-items: center;
}
h1{
color: #fff;
background: rgba(255,255,255,.2);
padding: 20px;
border-radius: 10px;
}
@keyframes animate{
0%{
background-position: 0 50%;
}
50%{
background-position: 100% 50%;
}
100%{
background-position: 0 50%;
}
}
</style>
</head>
<body onLoad="pageScroll()">
<section>
<div class='header'>
<h1>
CHAT ROOM
<?php // Adding the logout link only for logged in users ?>
<?php if(isset($_SESSION['username'])) { ?>
<a class='logout' href="?logout">Logout</a>
<?php } ?>
</h1>
</div>
<div class="demo-1">
<h3 id="my-Title" style="font-size: 30px !important">Welcome to Cat Room</h3>
</div>
<div class='main'>
<?php //Check if the user is logged in or not ?>
<?php if(isset($_SESSION['username'])) { ?>
<div id='result'></div>
<div class='chatcontrols'>
<form method="post" onsubmit="return submitchat()">
<input type='text' name='chat' id='chatbox' autocomplete="off" placeholder="ENTER CHAT HERE" />
<input type='submit' name='send' id='send' class='btn btn-send' value='Send' />
<input type='button' name='clear' class='btn btn-clear'style="" id='clear' value='Image'onclick="toggle_visibility('imgpic'),toggle_visibility('sedy')" title="Clear Chat" />
<input type='text' name='imgy' id="imgpic" style="display:none" placeholder="IMAGE URL !" />
<input type='button' name='sedy' id='sedy'style="display:none;background-color:#000099;color:white;position: relative;" value='Send-image'onclick="submitimg();" autocomplete="off" />
</form>
<input type="button" onClick="pageScroll()" value="Scroll Page">
<input type="button" onClick="stopScroll()" value="Stop Scroll">
<script>
function submitimg(){
var xey=$('#imgpic').val();
xey = xey.replace(/https:\/\/|http:\/\/r/gi,'');
xey=xey.replace("http://","");
if($('#imgy').val()=='' || xey==''|| xey==' ' || xey==' ' ) return false;
else{
$.ajax({
url:'chat.php',
data:{imgy:xey,ajaximg:true},
method:'post',
success:function(data){
$('#result').html(data);
$('#imgpic').val('') // Get the chat records and add it to result div
//xey; //Clear chat box after successful submition
}
})
}
return false;
};
// Javascript function to submit new chat entered by user
function submitchat(){
if($('#chat').val()=='' || $('#chatbox').val()=='' || $('#chatbox').val()==' ' || $('#chatbox').val()==' ') return false;
$.ajax({
url:'chat.php',
data:{chat:$('#chatbox').val(),ajaxsend:true},
method:'post',
success:function(data){
$('#result').html(data); // Get the chat records and add it to result div
$('#chatbox').val(''); //Clear chat box after successful submition
document.getElementById('result').scrollTop=document.getElementById('result').scrollHeight; // Bring the scrollbar to bottom of the chat resultbox in case of long chatbox
}
})
return false;
};
// Function to continously check the some has submitted any new chat
setInterval(function(){
$.ajax({
url:'chat.php',
data:{ajaxget:true},
method:'post',
success:function(data){
$('#result').html(data);
}
})
},1000);
// Function to chat history
$(document).ready(setInterval(function(){
$.ajax({
url:'chat.php',
data:{username:"",ajaxclear:true},
method:'post',
success:function(data){
$('#result').html(data);
}
})
},900000))
function pageScroll() {
window.scrollBy(0,50); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll()',100); // scrolls every 100 milliseconds
}
function stopScroll() {
clearTimeout(scrolldelay);
}
</script>
<script type="text/javascript">
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
</script>
<?php } else { ?>
<div class='userscreen'>
<form method="post" >
<input type='text' class='input-user' placeholder="ENTER YOUR NAME HERE" name='username' required />
<input type='submit' class='btn btn-user' name="submit" value='START CHAT' />
<p>
Resolve the simple captcha below: <br />
<p><img src="https://codebyus.org/image.php?captcha_text=<?php echo $_SESSION['captcha']; ?>"></p>
<input name="captchaResult" type="text" size="5" required />
<input name="firstNumber" type="hidden" value="<?php echo $random_number1; ?>" />
<input name="secondNumber" type="hidden" value="<?php echo $random_number2; ?>" />
<input name="cap" type="hidden" value="<?php echo $captcha; ?>"/>
</p>
</form>
</div>
<?php } ?>
</div>
<?php include_once 'online.php';?>
</body>
</section>
</html>
<footer id="page-footer">
<p style="color:#cc66ff">CODE WITH ❤ BY JABOSKI</p>
</footer>