Commit 8fe4bcaf authored by Nico Schallehn's avatar Nico Schallehn

James informiert jetzt über fehlgeschlagene private Nachrichten

parent 42135974
......@@ -22,6 +22,8 @@ function ChatNachricht($text, $admin, $userchange ){
if($admin != 3) $text = addslashes(htmlspecialchars($text));
$admin = addslashes(htmlspecialchars($admin));
$userchange = addslashes(htmlspecialchars($userchange));
$UserID = 0;
$time = time()+2;
if((substr(trim($text), 0, 3) == "/p ") OR (substr(trim($text), 0, 3) == "/w "))
{
$end = strpos($text, ":");
......@@ -29,15 +31,16 @@ function ChatNachricht($text, $admin, $userchange ){
$name = substr($text, 3, $end-3);
$UserID = UsernametoID($name);
$text = substr($text, $end+1);
}
if ($UserID == false){
sendMessage( "Deine Nachricht an ".$name." konnte ich leider nicht zustellen :-(", 1, 0, 0, $admin, $time, 0, $_SESSION['chatuserid']);
}else{
sendMessage( $text, $_SESSION['chatuserid'], $userchange, 0, $admin, time(), 0, $UserID );
}
/*mysql_query("INSERT INTO chat (user_id, nachricht, userchange, admin, chat_time, privat) VALUES
('{$_SESSION['chatuserid']}', '$text', '$userchange', '$admin', '" . time() . "', '$UserID')");*/
sendMessage( $text, $_SESSION['chatuserid'], $userchange, 0, $admin, time(), 0, $UserID );
//echo "INSERT INTO chat (user_id, nachricht, userchange, admin, chat_time, privat) VALUES ('{$_SESSION['chatuserid']}', '$text', '$userchange', '$admin', '" . time() . "', '$UserID')";
//mysql_query("UPDATE user SET chat = '".mysql_insert_id()."' WHERE id = '{$_SESSION['chatuserid']}'");
if ((preg_match("/James/i",$text)) OR ($UserID == 1))
{
$time = time()+2;
if (preg_match("/wie/i",$text) AND preg_match("/geht/i",$text))
$JamesText= "Mir geht es gut und dir ".IDtoUsername($_SESSION['chatuserid'])."?";
else if(preg_match("/danke/i",$text))
......@@ -104,9 +107,14 @@ function IDtoUsername($ID)
function UsernametoID($name)
{
$result = mysql_query("SELECT * FROM user WHERE name LIKE '".htmlentities($name)."'");
while($User = mysql_fetch_array($result))
{
return $User['id'];
if(mysql_num_rows($result) == 1){
while($User = mysql_fetch_array($result))
{
return $User['id'];
}
}
else{
return false;
}
}
function UserTable ($asarray = FALSE){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment