Skip to content
Snippets Groups Projects
Commit 875cdfb7 authored by isaack's avatar isaack
Browse files

kleine bugs

parent 502e9f08
Branches
No related merge requests found
...@@ -99,7 +99,7 @@ if($esc['bdate'] == 0){ ...@@ -99,7 +99,7 @@ if($esc['bdate'] == 0){
if($nickpage['ava'] == ''){ if($nickpage['ava'] == ''){
echo '<div class="alert alert-info">Kein Avatar gew&auml;hlt</div>'; echo '<div class="alert alert-info">Kein Avatar gew&auml;hlt</div>';
}else{ }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> </td>
......
<?php <?php
class chatClass class chatClass{
{ public static function getRestChatLines($id){
public static function getRestChatLines($id) global $db_host,$db_user,$db_pass,$db_base;
{ $arr = array();
global $db_host,$db_user,$db_pass,$db_base; $jsonData = '{"results":[';
$arr = array(); $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base);
$jsonData = '{"results":['; $db_connection->query( "SET NAMES 'UTF8'" );
$db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); $statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? ");
$db_connection->query( "SET NAMES 'UTF8'" ); $statement->bind_param( 'i', $id);
$statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? "); $statement->execute();
$statement->bind_param( 'i', $id); $statement->bind_result( $id, $usrname, $chattext, $chattime);
$statement->execute(); $line = new stdClass;
$statement->bind_result( $id, $usrname, $chattext, $chattime); while ($statement->fetch()) {
$line = new stdClass; $line->id = $id;
while ($statement->fetch()) { $line->usrname = $usrname;
$line->id = $id; $line->chattext = $chattext;
$line->usrname = $usrname; $line->chattime = date('H:i:s', $chattime);
$line->chattext = $chattext; $arr[] = json_encode($line);
$line->chattime = date('H:i:s', $chattime); }
$arr[] = json_encode($line); $statement->close();
} $db_connection->close();
$statement->close(); $jsonData .= implode(",", $arr);
$db_connection->close(); $jsonData .= ']}';
$jsonData .= implode(",", $arr); return $jsonData;
$jsonData .= ']}';
return $jsonData;
} }
public static function setChatLines( $chattext, $usrname, $color) { public static function setChatLines( $chattext, $usrname, $color) {
$db_connection = new mysqli( mysqlServer, mysqlUser, mysqlPass, mysqlDB); global $db_host,$db_user,$db_pass,$db_base;
$db_connection->query( "SET NAMES 'UTF8'" ); $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base);
$statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)"); $db_connection->query( "SET NAMES 'UTF8'" );
$statement->bind_param( 'sss', $usrname, $color, $chattext); $statement = $db_connection->prepare( "INSERT INTO chat( usrname, color, chattext) VALUES(?, ?, ?)");
$statement->execute(); $statement->bind_param( 'sss', $usrname, $color, $chattext);
$statement->close(); $statement->execute();
$db_connection->close(); $statement->close();
$db_connection->close();
} }
} }
?> ?>
\ No newline at end of file
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