Simple status box for the sidebar.
[elgg_plugins.git] / forwarder / friendly.php
blob037004a33836f8900647e1647fb24899c3c91565
1 <?php
3 require("../../includes.php");
5 global $page_owner;
6 global $CFG, $db;
7 $profile_name = optional_param('profile_name', '-1', PARAM_ALPHANUM);
8 $sql = "select * from ".$CFG->prefix."user_flags where flag = 'friendlyname' and value = " . $db->qstr($profile_name);
10 if ($page_owner = get_record_sql($sql)) {
11 $page_owner = $page_owner->user_id;
12 } else {
13 header("Location: $CFG->wwwroot");
14 exit;
17 $username = user_info("username",$page_owner);
18 $forwarder = user_flag_get('forwarder', $page_owner);
20 if ($forwarder) {
21 header("Location: ".$CFG->wwwroot . $username . "/" . $forwarder . "/");
22 } else {
23 header("Location: ".$CFG->wwwroot."$username/profile/");