Esempio n. 1
0
				<table id="setting_table">
				<tr>
				<td class="setting_title">Name: </td>
				<td><input class="setting_input" type="text" name="name" value="<?php 
        echo isset($user->name) ? $user->name : '';
        ?>
" /></td>
				</tr>
				<tr>
				<td class="setting_title">URL: </td>
				<td><input class="setting_input" type="text" name="url" value="<?php 
        if (!isset($user->url)) {
            echo '';
        } else {
            $hops = array();
            $newurl = expandRedirect($user->url, $hops);
            echo $newurl;
        }
        ?>
" /></td>
				</tr>
				<tr>
				<td class="setting_title">Location: </td>
				<td><input class="setting_input" type="text" name="location" value="<?php 
        echo isset($user->location) ? $user->location : '';
        ?>
" /></td>
				</tr>
				<tr>
				<td class="setting_title">Bio: </td><td><small style="margin-left:5px;vertical-align: top;">*Max 160 chars</small></td>
				</tr><tr>
Esempio n. 2
0
function expandRedirect($shorturl, &$hops)
{
    if (count($hops) >= 10) {
        return false;
    }
    $head = array_change_key_case(get_headers($shorturl, TRUE), CASE_LOWER);
    if (!isset($head['location']) || empty($head['location'])) {
        return $shorturl;
    }
    $prevhop = $shorturl;
    foreach ((array) $head['location'] as $redir) {
        if (substr($redir, 0, 1) == '/' || preg_match('/[\\.\\/]' . preg_quote(parse_url($prevhop, PHP_URL_HOST)) . '$/', parse_url($redir, PHP_URL_HOST))) {
            return $prevhop;
        }
        $hops[] = $prevhop;
        $prevhop = $redir;
    }
    return expandRedirect($redir, $hops);
}