function list_propinsi($p_key_search, $p_page, $p_page_size) { global $conn, $ws_svr; if (!CheckAuth($ws_svr->requestHeader)) { $return['data_count'] = 0; $return['data'] = 0; } else { $v_key_search = !$p_key_search || $p_key_search == '' ? '' : $p_key_search; $v_page = !$p_page || $p_page == '' ? 0 : $p_page; $v_page_size = !$p_page_size || $p_page_size == '' ? 10 : $p_page_size; $v_page = (int) $v_page; $v_page_size = (int) $v_page_size; $v_key_search = '%' . $v_key_search . '%'; $v_key_search = (string) $v_key_search; $sql = "SELECT * \nFROM info_penduduk_propinsi\nWHERE prop_nama like '%s' \nLIMIT %d, %d"; $sql = sprintf($sql, $v_key_search, $v_page, $v_page_size); $stmt = mysql_query($sql, $conn); $return_data_count = mysql_affected_rows($conn); $return_data = array(); if (is_resource($stmt)) { while ($row = mysql_fetch_array($stmt)) { $return_data[] = $row; } } $return['data_count'] = $return_data_count; $return['data'] = $return_data; } //encode data $return = base64_encode(serialize($return)); return $return; }
function list_prodi($p_key_search, $p_page, $p_page_size) { global $conn, $ws_svr; if (!CheckAuth($ws_svr->requestHeader)) { $return['data_count'] = 0; $return['data'] = 0; } else { $v_key_search = !$p_key_search || $p_key_search == '' ? '' : $p_key_search; $v_page = !$p_page || $p_page == '' ? 0 : $p_page; $v_page_size = !$p_page_size || $p_page_size == '' ? 10 : $p_page_size; $v_page = (int) $v_page; $v_page_size = (int) $v_page_size; $v_key_search = '%' . $v_key_search . '%'; $v_key_search = (string) $v_key_search; $sql = "SELECT * \n\t\t\t\tFROM uinjogja\n\t\t\t\tWHERE nama_prodi like '%s' \n\t\t\t\tLIMIT %d, %d"; $sql = sprintf($sql, $v_key_search, $v_page, $v_page_size); //$sql = "call select_pkg('session_id_nya');"; $stmt = mysql_query($sql, $conn); $return_data_count = mysql_affected_rows($conn); $return_data = array(); if (is_resource($stmt)) { while ($row = mysql_fetch_array($stmt)) { $return_data[] = $row; } } $return['data_count'] = $return_data_count; $return['data'] = $return_data; } //decode data $return = base64_encode(serialize($return)); return $return; }
<?php session_start(); include '../libs/macro.php'; @includeFiles('../libs/'); CheckAuth(); $HTML['CENTER'] = array('form_legenda' => array('cacheKey' => 'form_legenda'), 'legenda' => array('cacheKey' => 'legenda')); $HTML['HEADER'] = array('nawigacja' => array('cacheKey' => 'nawigacja')); $HTML['LEFT'] = array('help'); $META['title'] = 'Adminstracja MZK Lębork - Legenda'; $sys =& new System($HTML, $META); include '../views/view2coladmin.php'; ?>
if ($digest = GetDigest()) { $hdr = array(); preg_match_all('/(\\w+)=(?:"([^"]+)"|([^\\s,]+))/', $digest, $mtx, PREG_SET_ORDER); foreach ($mtx as $m) { $hdr[$m[1]] = $m[2] ? $m[2] : $m[3]; } if (md5(secret) != $hdr['nonce']) { return false; } // if ($Options->login != $hdr['username']) return false; // $a1 = strtolower($profile['auth_password']); $a1 = strtolower(md5('test:mytest:test')); $a2 = $hdr['qop'] == 'auth-int' ? md5(implode(':', array($_SERVER['REQUEST_METHOD'], $hdr['uri'], md5($entity_body)))) : md5(implode(':', array($_SERVER['REQUEST_METHOD'], $hdr['uri']))); $ok = md5(implode(':', array($a1, $hdr['nonce'], $hdr['nc'], $hdr['cnonce'], $hdr['qop'], $a2))); return $ok == $hdr['response']; } return false; } define('secret', 'mysecret'); if (CheckAuth()) { echo "succes\n"; } //echo "not auth\n"; //return; $s = sprintf('WWW-Authenticate: Digest qop="auth-int, auth", realm="%s", domain="%s", nonce="%s", opaque="%s", stale="%s", algorithm="MD5"', 'mytest', '/', md5(secret), md5('mytest'), 'false'); header($s); header('HTTP/1.0 401 Unauthorized'); echo "<pre>\n"; //echo $s, "\n"; var_dump($PHP_AUTH_DIGEST); var_dump($_SERVER);
$ip = $array[0]; $user = $array[1]; $auth = urldecode($array[2]); $ID = $array[3]; $authR = explode(" ", $auth); $TypeAuth = $authR[0]; $Ident = base64_decode($authR[1]); if (preg_match("#ID([0-9]+)#", $ID, $re)) { $ID = $re[1]; } $GLOBALS["OBJECTID"] = $ID; $identR = explode(":", $Ident); $username = $identR[0]; unset($identR[0]); $password = @implode(":", $identR); if (!CheckAuth($ID, $username, $password, $ip)) { WLOG("[FAILED]: ID = {$ID}; IP = {$ip}; ident:{$username}"); fwrite(STDOUT, "ERR\n"); continue; } WLOG("[SUCCESS]: ID = {$ID}; IP = {$ip}; ident:{$username}"); fwrite(STDOUT, "OK\n"); } } SaveSessions(); $distanceInSeconds = round(abs(time() - $GLOBALS["STARTIME"])); $distanceInMinutes = round($distanceInSeconds / 60); WLOG("[STOP]: <span style='color:#002FB2'>Stopping process v1.0: After ({$distanceInSeconds}s - about {$distanceInMinutes}mn)</span>"); WLOG("[STOP]: <span style='color:#002FB2'>This process was query the LDAP server <strong>{$GLOBALS["QUERIES_NUMBER"]}</strong> times...</span>"); if (isset($GLOBALS["F"])) { @fclose($GLOBALS["F"]);