function parse_candidates($_xml_str) { if (empty($_xml_str)) { return null; } $candidates = array(); $dom = new XMLDOM(); $xml_dom = $dom->load_from_xml($_xml_str); if (!empty($xml_dom)) { $tags = array('email_addr', 'phone_num', 'name', 'social', 'current_position', 'current_employer'); $candidates = $dom->get_assoc($tags); foreach ($candidates as $i => $candidate) { $candidates[$i]['name'] = sanitize(stripslashes($candidate['name'])); $candidates[$i]['current_position'] = sanitize(stripslashes($candidate['current_position'])); $candidates[$i]['current_employer'] = sanitize(stripslashes($candidate['current_employer'])); if (is_null($candidate['social']) || empty($candidate['social'])) { $candidates[$i]['social'] = 'NULL'; } else { $candidates[$i]['social'] = strtolower($candidate['social']); } } } return $candidates; }
switch ($node->nodeName) { case "key": $key = $node->nodeValue; $propertys[$key] = array(); break; default: if (!empty($key)) { if ($node->nodeName != '#text') { $propertys[$key][$node->nodeName] = $node->nodeValue; } } break; } } } echo "<pre>"; print_r($propertys); echo "</pre>"; } else { echo "failed"; } echo "<br><br>"; echo "get_assoc test: <br><br>"; if ($xml_dom->load_from_uri(dirname(__FILE__) . "/text3.xml")) { $propertys = $xml_dom->get_assoc(array('key', 'value', 'default')); echo "<pre>"; print_r($propertys); echo "</pre>"; } else { echo "failed"; }
<?php require_once "../private/lib/utilities.php"; $xml_seed = new XMLDOM(); $xml_seed->load_from_uri("http://localhost/yel2/members/seed.php"); $data = $xml_seed->get_assoc(array('id', 'seed')); $sid = $data[0]['id']; $seed = $data[0]['seed']; $uid = '*****@*****.**'; $password = '******'; $hash = sha1($uid . md5($password) . $seed); echo $sid . ": " . $seed . "<br>"; echo $hash . "<br>"; ?> <p style="font-weight: bold;">Logging in... </p><p><?php $member = new Member($uid, $sid); if ($member->is_registered($hash)) { if ($member->session_set($hash)) { echo "Success"; } } if (!$member->is_logged_in($hash)) { echo "failed"; exit; } ?> </p>