From 875cdfb79c4cac3cfc85bfa9a84244e5efa27bfb Mon Sep 17 00:00:00 2001 From: isaack <isaack0815@gmail.com> Date: Sun, 3 Dec 2017 11:45:25 +0100 Subject: [PATCH] kleine bugs --- content/konto/nickpage.php | 2 +- lib/class/chat.class.php | 67 +++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/content/konto/nickpage.php b/content/konto/nickpage.php index d2b6ea3..de590cd 100644 --- a/content/konto/nickpage.php +++ b/content/konto/nickpage.php @@ -99,7 +99,7 @@ if($esc['bdate'] == 0){ if($nickpage['ava'] == ''){ echo '<div class="alert alert-info">Kein Avatar gewählt</div>'; }else{ - echo '<a href="#" class="thumbnail"><img src="'. $nickpage['ava'] .'" alt="'. $_SESSIOn['uid'] .'"></a>'; + echo '<a href="#" class="thumbnail"><img src="'. $nickpage['ava'] .'" alt="'. $_SESSION['uid'] .'"></a>'; } ?> </td> diff --git a/lib/class/chat.class.php b/lib/class/chat.class.php index fc9d9c6..0dba0a4 100644 --- a/lib/class/chat.class.php +++ b/lib/class/chat.class.php @@ -1,41 +1,40 @@ <?php -class chatClass - { - public static function getRestChatLines($id) - { - global $db_host,$db_user,$db_pass,$db_base; - $arr = array(); - $jsonData = '{"results":['; - $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); - $db_connection->query( "SET NAMES 'UTF8'" ); - $statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? "); - $statement->bind_param( 'i', $id); - $statement->execute(); - $statement->bind_result( $id, $usrname, $chattext, $chattime); - $line = new stdClass; - while ($statement->fetch()) { - $line->id = $id; - $line->usrname = $usrname; - $line->chattext = $chattext; - $line->chattime = date('H:i:s', $chattime); - $arr[] = json_encode($line); - } - $statement->close(); - $db_connection->close(); - $jsonData .= implode(",", $arr); - $jsonData .= ']}'; - return $jsonData; +class chatClass{ + public static function getRestChatLines($id){ + global $db_host,$db_user,$db_pass,$db_base; + $arr = array(); + $jsonData = '{"results":['; + $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); + $db_connection->query( "SET NAMES 'UTF8'" ); + $statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? "); + $statement->bind_param( 'i', $id); + $statement->execute(); + $statement->bind_result( $id, $usrname, $chattext, $chattime); + $line = new stdClass; + while ($statement->fetch()) { + $line->id = $id; + $line->usrname = $usrname; + $line->chattext = $chattext; + $line->chattime = date('H:i:s', $chattime); + $arr[] = json_encode($line); + } + $statement->close(); + $db_connection->close(); + $jsonData .= implode(",", $arr); + $jsonData .= ']}'; + return $jsonData; } public static function setChatLines( $chattext, $usrname, $color) { - $db_connection = new mysqli( mysqlServer, mysqlUser, mysqlPass, mysqlDB); - $db_connection->query( "SET NAMES 'UTF8'" ); - $statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)"); - $statement->bind_param( 'sss', $usrname, $color, $chattext); - $statement->execute(); - $statement->close(); - $db_connection->close(); + global $db_host,$db_user,$db_pass,$db_base; + $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); + $db_connection->query( "SET NAMES 'UTF8'" ); + $statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)"); + $statement->bind_param( 'sss', $usrname, $color, $chattext); + $statement->execute(); + $statement->close(); + $db_connection->close(); } - } +} ?> \ No newline at end of file -- GitLab