Skip to content

Instantly share code, notes, and snippets.

@fajran
Created March 13, 2012 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fajran/2028817 to your computer and use it in GitHub Desktop.
Save fajran/2028817 to your computer and use it in GitHub Desktop.
Referer
<pre>
File: <?=basename($_SERVER['SCRIPT_FILENAME']);?>
Referer: <?=$_SERVER['HTTP_REFERER'];?>
Lanjut: <a href="index.php">index.php</a>
<a href="a.php">a.php</a>
<a href="b.php">b.php</a>
<a href="c.php">c.php</a>
Loncat: <a href="loncat-ke-index.php">loncat-ke-index.php</a>
<a href="loncat-ke-a.php">loncat-ke-a.php</a>
<a href="loncat-ke-b.php">loncat-ke-b.php</a>
<a href="loncat-ke-c.php">loncat-ke-c.php</a>
Source: <a href="<?=basename($_SERVER['SCRIPT_FILENAME']);?>s"><?=basename($_SERVER['SCRIPT_FILENAME']);?>s</a>
<a href="loncat-ke-<?=basename($_SERVER['SCRIPT_FILENAME']);?>s">loncat-ke-<?=basename($_SERVER['SCRIPT_FILENAME']);?>s</a>
<?php
$fname = basename($_SERVER['SCRIPT_FILENAME']);
preg_match('/^loncat-ke-(\w+)\.php$/', $fname, $m);
if (isset($m[1])) {
$next = $m[1];
header('location: ' . $next . '.php');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment