-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.php
58 lines (55 loc) · 1.61 KB
/
input.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
<html>
<body id="body" OnLoad="document.chatform.smess.focus();">
<link rel="stylesheet" type="text/css" href="style.css" />
<?php
$sqlinfo=array();
// EDIT THESE LINES
$sqlinfo['address']="localhost";
$sqlinfo['user']="sqluser";
$sqlinfo['password']="sqlpassword";
$sqlinfo['db']="gosbot";
$sqlinfo['table']="goschat";
// DONE EDITING
if (isset($_GET['uid'])){
$id=$_GET['uid'];
$name=$_GET['name'];
}else{
$id=$_POST['id'];
$name=$_POST['name'];
}
//dumping spaces to open up the flush buffer.
echo str_repeat(" ", 1024), "\n";
require('sql.php');
// !!!Start of functions.
//function to display our chat input
function formit($name,$id){
echo "<FORM NAME =chatform METHOD =POST ACTION = input.php>";
echo "<INPUT TYPE=hidden VALUE=".$id." name=id>";
echo "<input type='hidden' VALUE=".$name." name=name />";
echo "<INPUT TYPE=TEXT VALUE='' name=smess size=85>";
echo "<INPUT TYPE = Submit Name = sayit id=chatbutton VALUE ='Say it'>";
echo "</form>";
}
// End of Functions!!!
//if message was sent and has a message.
if (isset($_POST['name']) && $_POST['smess'] != "") {
$info=array($sqlinfo['address'],$sqlinfo['user'],$sqlinfo['password'],$sqlinfo['db'],$sqlinfo['table']);
$smess=$_POST['smess'];
$tgt="public";
// getting rid of the 's sql hates them
$smess=ereg_replace("'","",$smess);
$dta=array("msg","trgt","user","id");
$value=array($smess,$tgt,$name,$id);
$howmany=4;
//sending message to sql
sqlw($howmany,$value,$info,$dta);
formit($name,$id);
}
//if the button was pressed and no message redisplay the form.
elseif (isset($_POST['name'])){
formit($name,$id);
}
else{formit($name,$id);}
?>
</body>
</html>