File: redirect.php

package info (click to toggle)
jquery-mobile 1.4.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 15,808 kB
  • sloc: makefile: 42; php: 18
file content (25 lines) | stat: -rw-r--r-- 1,069 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
	// ************************************************************************
	// The two-second sleep simulates network delays, hopefully causing a
	// loading indicator message to appear on the client side.
	// ************************************************************************
	sleep(2);

	$dst = ( isset( $_GET[ "to" ] )
		? $_GET[ "to" ]
		: ( isset( $_POST[ "to" ] )
			? $_POST[ "to" ]
			: false ) );
	if ( $dst ) {
		// **********************************************************************
		// The crucial line: Issue a custom header with the location to which the
		// redirect should happen. For simplicity, we simply redirect to whatever
		// location was specified in the request's "to" parameter, but real-world
		// scripts can compute the destination based on server-side state.
		//
		// NB: This is not a HTTP redirect. As far as HTTP is concerned, this is
		// a normal request/response cycle with a status code of 200.
		// **********************************************************************
		header( "X-Redirect: " . $dst );
	}
?>