Jump to content

Errors.... making an auto responder


Alienware

Recommended Posts

Ok so, i run an online game.. when you send a message at the moment it says "message sent" or something along those lines.

 

I am wanting to make it so that if a moderator or Admin wished to have an auto responder for if people message them... they can have one saying they recieve a high quantity of messages... that it may take time to reply.

 

 

So far in the database under "players" i have made a new field called "Autoreply".. i used ENUM ('0','1')

 

Im wanting to make it so that if a member of staff has their "Auto Responder" set to "1" the new message will appear to players when they message them.

 

Hope this makes sense...

 

I added onto the send message code... not all i am getting are line errors... i have probably coded it all wrong.. but i hope somebody can help me.

 

<?php
require("commBan.php.inc");
require("connections/db.php");
require("connections/require.php");

$auto = mysql_query("SELECT * FROM `players` WHERE `Autoreply` = '$one' LIMIT 1")or die(mysql_error());

$qry = mysql_query("SELECT * FROM `players` WHERE `playername` = '$player' LIMIT 1")or die(mysql_error());
$arr = mysql_fetch_array($qry);

$from = $_GET['to'];
$rep = $_GET['rep'];

if ($rep){
$que = mysql_query("SELECT * FROM `inbox` WHERE `id` = '$rep' LIMIT 1")or die(mysql_error());
$ary = mysql_fetch_array($que);

$from = $ary['from'];
$tit = $ary['title'];
$on = $ary['date'];
$mssg = $ary['message'];
$autorep = $ary['reply'];
}

$submit = strip_tags($_POST['submit']);
$user = strip_tags($_POST['user']);
$title = addslashes($_POST['title']);
$msg = addslashes(strip_tags($_POST['msg']));

if ($submit){

if (!$user){
$error = "Please specify which player you wist to send a message to.";
error($error);
}elseif ($user){

if (!$title){
$title = "None";
}

if (!$msg){
$error = "Please enter a message to send.";
error($error);
}elseif ($msg){

if (ereg("[^A-Za-z0-9]", $user)){
$error = "Playername can only contain alphanumeric characters.";
error($error);
}elseif (!ereg("[^A-Za-z0-9]", $user)){

$chk = mysql_query("SELECT `id` FROM `players` WHERE `playername` = '$user' LIMIT 1")or die(mysql_error());
$exist = mysql_numrows($chk);

if ($exist == 0){
$error = "That player does not exist.";
error($error);
}elseif ($exist == 1){

mysql_query("INSERT INTO `inbox` ( `id` , `playername` , `from` , `title` , `message` , `read` , `date` , `protected` )
VALUES
( '' , '$user' , '$player' , '$title' , '$msg' , '0' , '$date' , '0' )")or die(mysql_error());


if ($auto == 0){
$upd = "Message sent to <a href=\"profile.php?player=".$user."\" target=\"main\">".$user.".";
upd($upd);
)elseif ($auto == 1){
$autorep = "Message sent to <a href=\"profile.php?player=".$user."\" target=\"main\">".$user."."<br><br>Thank you for taking the time to message us!<br>As we recieve such a high amount of messages a day we are not always able to respond to all messages immediately<br>
If your question is of the non urgent type then please feel free to use the Helpdesk or message a HDO for further assistance!
<br>Thank you for understanding.<br>
NYM Staff.

}}}}}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="connections/style.css" />
</head>
<body>
<form action="" method="post">
<table width="50%" align="center" class="tbl">
<tr><td align="center" class="hdr" colspan="2">
.::Send Message::.
</td></tr>
<tr>
<td align="center" class="tbl">To</td>
<td align="center" class="tbl">
<input type="text" name="user" class="submit" size="20" maxlength="20" value="<? echo $from; ?>">
</td>
</tr>
<tr>
<td align="center" class="tbl">Title</td>
<td align="center" class="tbl">
<input type="text" name="title" class="submit" size="20" maxlength="20" value="<? echo $tit; ?>">
</td>
</tr>
<tr><td align="center" class="sub" colspan="2">Message</td></tr>
<tr><td align="center" class="tbl" colspan="2">
<textarea name="msg" class="submit" cols="35" rows="5">

<?php
if ($rep){
print ("

[b]On: ".$on." ".$from." Wrote:[/b]

".$mssg."");
}
?>
</textarea>
</tr></tr>
<tr><td align="center" colspan="4"><? sub(submit,Send); ?></td></tr>
</table>
</form>
</body>
</html>

Link to comment
Share on other sites

I have done a little mreo work.. its still not working but here is what i have-

 

<?php
require("commBan.php.inc");
require("connections/db.php");
require("connections/require.php");



$qry = mysql_query("SELECT * FROM `players` WHERE `playername` = '$player' LIMIT 1")or die(mysql_error());
$arr = mysql_fetch_array($qry);

$from = $_GET['to'];
$rep = $_GET['rep'];

if ($rep){
$que = mysql_query("SELECT * FROM `inbox` WHERE `id` = '$rep' LIMIT 1")or die(mysql_error());
$ary = mysql_fetch_array($que);

$from = $ary['from'];
$tit = $ary['title'];
$on = $ary['date'];
}

$submit = strip_tags($_POST['submit']);
$user = strip_tags($_POST['user']);
$title = addslashes($_POST['title']);
$msg = addslashes(strip_tags($_POST['msg']));

if ($submit){

if (!$user){
$error = "Please specify which player you wist to send a message to.";
error($error);
}elseif ($user){

if (!$title){
$title = "None";
}

if (!$msg){
$error = "Please enter a messagAe to send.";
error($error);
}elseif ($msg){

if (ereg("[^A-Za-z0-9]", $user)){
$error = "Playername can only contain alphanumeric characters.";
error($error);
}elseif (!ereg("[^A-Za-z0-9]", $user)){

$chk = mysql_query("SELECT `id` FROM `players` WHERE `playername` = '$user' LIMIT 1")or die(mysql_error());
$exist = mysql_numrows($chk);

if ($exist == 0){
$error = "That player does not exist.";
error($error);
}elseif ($exist == 1){

mysql_query("INSERT INTO `inbox` ( `id` , `playername` , `from` , `title` , `message` , `read` , `date` , `protected` )
VALUES
( '' , '$user' , '$player' , '$title' , '$msg' , '0' , '$date' , '0' )")or die(mysql_error());

$auto = mysql_query("SELECT * FROM `players` WHERE `Autoreply` = '$aut' LIMIT 1")or die(mysql_error());


if ($aut == 0){
$upd = "Message sent to <a href=\"profile.php?player=".$user."\" target=\"main\">".$user.".";
upd($upd);
)elseif ($aut == 1){
$autorep = "Message sent to <a href=\"profile.php?player=".$user."\" target=\"main\">".$user."."<br><br>Thank you for taking the time to message us!<br>As we recieve such a high amount of messages a day we are not always able to respond to all messages immediately<br>
If your question is of the non urgent type then please feel free to use the Helpdesk or message a HDO for further assistance!
<br>Thank you for understanding.<br>
NYM Staff."

}}}}}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="connections/style.css" />
</head>
<body>
<form action="" method="post">
<table width="50%" align="center" class="tbl">
<tr><td align="center" class="hdr" colspan="2">
.::Send Message::.
</td></tr>
<tr>
<td align="center" class="tbl">To</td>
<td align="center" class="tbl">
<input type="text" name="user" class="submit" size="20" maxlength="20" value="<? echo $from; ?>">
</td>
</tr>
<tr>
<td align="center" class="tbl">Title</td>
<td align="center" class="tbl">
<input type="text" name="title" class="submit" size="20" maxlength="20" value="<? echo $tit; ?>">
</td>
</tr>
<tr><td align="center" class="sub" colspan="2">Message</td></tr>
<tr><td align="center" class="tbl" colspan="2">
<textarea name="msg" class="submit" cols="35" rows="5">

<?php
if ($rep){
print ("

[b]On: ".$on." ".$from." Wrote:[/b]

".$mssg."");
}
?>
</textarea>
</tr></tr>
<tr><td align="center" colspan="4"><? sub(submit,Send); ?></td></tr>
</table>
</form>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.