'Biography', 'research' => 'Research & Scholarship', 'publications' => 'Research Outputs', 'supervision' => 'Areas for Research Supervision'); $conn = mysqli_connect( $dbhost, $dbuser, $dbpass, $dbname ) ; if (mysqli_connect_errno( $conn )) { echo "Can't connect to database: ".mysqli_connect_error(); } if ( $conn ) { $field = ''; $id = ''; if ( $staffid != "" ) { $field = 'id'; $id = $staffid; } elseif ($staffuid != "") { if ( $staffuid == 'sbusjsns') { exit; } # hack to disable malicious link to profile, requested by HR $field = 'uid'; $id = $staffuid; $redirst = mysqli_prepare($conn, "SELECT id, uid from staffdata where uid = ?"); mysqli_stmt_bind_param( $redirst, 's', $id); mysqli_stmt_execute($redirst); $rediresult = mysqli_stmt_get_result($redirst); $staffdata = mysqli_fetch_object( $rediresult ); $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $url = strtok($urk, '?'); # hack for odd google search for andrew ball leading to empty profile for an SMUS username if ( $staffuid == 'smusame' ) { $staffdata->id = '465'; } header("Status: 301 Moved Permanently"); header("Location:$url?staffid=".$staffdata->id); exit; } else { echo(""); } $statement = "SELECT staffdata.*, schoolnames.schoolname, schoolnames.url schoolurl FROM staffdata, schoolnames WHERE staffdata.id = ? AND staffdata.school = schoolnames.id and staffdata.visible = 'yes'"; # echo "

$statement

"; $sdst = mysqli_prepare( $conn, $statement ); mysqli_stmt_bind_param( $sdst, 's', $id ); mysqli_stmt_execute($sdst); # mysqli_stmt_store_result($sdst); $result = mysqli_stmt_get_result($sdst); $staffdata = mysqli_fetch_object( $result ); if (mysqli_error($conn)) { echo "

".mysqli_error($conn)."

"; } # Now we redirect to pure $urlname = strtolower($staffdata->forename).'-'.strtolower($staffdata->surname); # fix up spaces in name $urlname = preg_replace('/[^-\w]/', '-', $urlname); header("Status: 301 Moved Permanently"); header("Location:http://pure.hud.ac.uk/en/persons/$urlname"); exit; } ?>