Chce wyrzystać jeden ze skryptów chatu. Aby nie musieć ręcznie dodawać uzytkowników pomyślałem że obecny kod można zastpić pobraniem z bazy w momencie logowania :
Obecny kształ pliku:
<?php /* * @package AJAX_Chat * @author Sebastian Tschan * @copyright (c) Sebastian Tschan * @license GNU Affero General Public License * @link https://blueimp.net/ajax/ */ // List containing the registered chat users: // Default guest user (don't delete this one): $users[0]['userRole'] = AJAX_CHAT_GUEST; $users[0]['userName'] = null; $users[0]['password'] = null; // Sample admin user: $users[1]['userRole'] = AJAX_CHAT_ADMIN; $users[1]['userName'] = 'admn'; $users[1]['password'] = 'haslo'; ?>
Brakuje mi pomysłu jak to zrobic . Czy dobrze kombinuje w ten sposób??
<?php /* * @package AJAX_Chat * @author Sebastian Tschan * @copyright (c) Sebastian Tschan * @license GNU Affero General Public License * @link https://blueimp.net/ajax/ */ // List containing the registered chat users: //pobieram dane z bazy selectem //liczę ile wierszy pobrało //instrukcją While przechodzę po kazdej i tworzę dane $x=8; while($x <= 8){ $users[$x]['userRole'] = dane; $users[$x]['userName'] = dane; $users[$x]['password'] = dane; } ?>