kenken999/php
0
1<?php2require_once("include/dbcommon.php");3require_once('classes/menupage.php');4 5 6if( !isLogged() || Security::isGuest() ) 7{8 Security::tryRelogin();9}10 11if( !isLogged() || Security::isGuest() )12{13 return;14}15 16$duration = 30;17$url = postvalue( "url" );18if( !$url ) {19 return;20}21 22if( strpos( $url , "://" ) !== false ) {23 // absolute url24 $host = hostFromUrl( $url );25} else {26 // relative url27 $host = projectHost();28}29 30$payload = array( 31 "username" => Security::getUserName(),32 "host" => $host,33 "external" => true,34 "origin" => projectUrl()35);36$jwt = jwt_encode( $payload, $duration );37if( strpos( $url, '?' ) !== false ) {38 $url .= "&token=" . $jwt;39} else {40 $url .= "?token=" . $jwt;41}42header("Location: " . $url );43?>