<?php
include_once ( 'init.php' ) ;
$mysqli = new mysqli( $db [ 'host' ] , $db [ 'user' ] , $db [ 'pass' ] , $db [ 'name' ] ) ;
if ( $mysqli -> connect_errno ) {
echo "Не удалось подключиться к MySQL: " . $mysqli -> connect_error ;
}
$stmt = $mysqli -> prepare ( "SELECT posts.post_id, posts.user_id, users.user_login, posts.post_text, posts.post_time, posts.is_deleted
FROM posts JOIN users on users.user_id = posts.user_id ORDER BY post_id" ) ;
$stmt -> execute ( ) ;
$queryResult = $stmt -> get_result ( ) ;
$posts = $queryResult -> fetch_all ( MYSQLI_ASSOC) ;
if ( isset ( $_SESSION [ 'user_login' ] ) ) { $userName = $_SESSION [ 'user_login' ] ;
$userId = $_SESSION [ 'user_id' ] ;
}
include ( 'view.php' ) ;
?>
PD9waHAKaW5jbHVkZV9vbmNlKCdpbml0LnBocCcpOwoKJG15c3FsaSA9IG5ldyBteXNxbGkoJGRiWydob3N0J10sICRkYlsndXNlciddLCAkZGJbJ3Bhc3MnXSwgJGRiWyduYW1lJ10pOwppZiAoJG15c3FsaS0+Y29ubmVjdF9lcnJubykgewogICAgZWNobyAi0J3QtSDRg9C00LDQu9C+0YHRjCDQv9C+0LTQutC70Y7Rh9C40YLRjNGB0Y8g0LogTXlTUUw6ICIgLiAkbXlzcWxpLT5jb25uZWN0X2Vycm9yOwp9Cgokc3RtdCA9ICRteXNxbGktPnByZXBhcmUoIlNFTEVDVCBwb3N0cy5wb3N0X2lkLCBwb3N0cy51c2VyX2lkLCB1c2Vycy51c2VyX2xvZ2luLCBwb3N0cy5wb3N0X3RleHQsIHBvc3RzLnBvc3RfdGltZSwgcG9zdHMuaXNfZGVsZXRlZAoJCQlGUk9NIHBvc3RzIEpPSU4gdXNlcnMgb24gdXNlcnMudXNlcl9pZCA9IHBvc3RzLnVzZXJfaWQgT1JERVIgQlkgcG9zdF9pZCIpOwoKJHN0bXQtPmV4ZWN1dGUoKTsKCiRxdWVyeVJlc3VsdCA9ICRzdG10LT5nZXRfcmVzdWx0KCk7CgokcG9zdHMgPSAkcXVlcnlSZXN1bHQtPmZldGNoX2FsbChNWVNRTElfQVNTT0MpOwoKaWYgKGlzc2V0KCRfU0VTU0lPTlsndXNlcl9sb2dpbiddKSkgewkKCSR1c2VyTmFtZSA9ICRfU0VTU0lPTlsndXNlcl9sb2dpbiddOwkKCSR1c2VySWQgPSAkX1NFU1NJT05bJ3VzZXJfaWQnXTsKfSAKCmluY2x1ZGUgKCd2aWV3LnBocCcpOwo/Pg==