summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2015-09-30 15:08:02 +0100
committerLuke Bratch <luke@bratch.co.uk>2015-09-30 15:08:02 +0100
commit218f98eb531fe0a23ef211050de913d3febf90ba (patch)
treec559dd035db5f3053fa826b6dec8d07111a448f4
parent8fb2d7b5c69e38bea780c758e15185bba0cef4f9 (diff)
Cater for URLs with no trailing slash where the programme ID is the last
component
-rw-r--r--iplayer.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/iplayer.php b/iplayer.php
index e97cc2a..5234fd4 100644
--- a/iplayer.php
+++ b/iplayer.php
@@ -7,6 +7,9 @@ if (isset($_GET['id'])) {
} else if (isset($_POST['url'])) {
$idpos = strpos($_POST['url'], "/episode/") + 9;
$idlen = strpos($_POST['url'], "/", $idpos) - $idpos;
+ if ($idlen < 1) {
+ $idlen = strlen($_POST['url']) - $idpos;
+ }
$id = substr($_POST['url'], $idpos, $idlen);
} else {
?>