Alienware Posted February 5, 2009 Share Posted February 5, 2009 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 https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/ Share on other sites More sharing options...
Alienware Posted February 5, 2009 Author Share Posted February 5, 2009 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 https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/#findComment-754996 Share on other sites More sharing options...
Alienware Posted February 5, 2009 Author Share Posted February 5, 2009 bump Link to comment https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/#findComment-755335 Share on other sites More sharing options...
Alienware Posted February 5, 2009 Author Share Posted February 5, 2009 Is nobody able to help me? Link to comment https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/#findComment-755352 Share on other sites More sharing options...
Alienware Posted February 5, 2009 Author Share Posted February 5, 2009 bump Link to comment https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/#findComment-755382 Share on other sites More sharing options...
Alienware Posted February 6, 2009 Author Share Posted February 6, 2009 bump Link to comment https://forums.phpfreaks.com/topic/143882-errors-making-an-auto-responder/#findComment-756258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.