Poniższy sposób działa, ale otrzymuję błąd:
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0
XML zawierający dane zarejestrowanych użytkowników:
<?xml version="1.0" encoding="UTF-8"?> <logowanie><user id="54a6a2acd3693" login="Asia" haslo="f9a6e5f05deefc3853f28d03e7e266e2"/></logowanie>
$xml = simplexml_load_file($userzy_xml); foreach ($xml->children() as $user) { if ($user['login'] == $login) { if ($user['haslo'] == $haslo) { $zalogowano = true; $id = $user['id']; //to wywoluje blad! } } }
if ($zalogowano == true) { $menu = '<a href="index.php">Przejdź do strony głównej</a><br/>'; $tresc = 'Zalogowano pomyślnie :)'; $_SESSION['twoje_id'] = $id; include_once 'szablon.php'; }