Jump to content

[SOLVED] true filename query


shamuraq

Recommended Posts

Hi Guys...

 

[scenario]:

I tied my filenames to my index.php using this script:

 

<?php

$id=$_GET['id'];

$f=$_GET['f'];

if (is_null($id)==true) {

$fname="s_index.php";

} else {

$fname="s_".$id.".php";

}

if (is_null($f)==true) {

$king="KO";

} else {

$fname=$f."/".$fname;

}

?>

 

so that the accessed page(eg. s_01.php) will end up as index.php?id=01

 

[Question]

How do i query the actual filename(eg. s_01.php) and the true path?

I tried using:

 

<?php

$currentFile = $_SERVER["PHP_SELF"];

$parts = Explode('/', $currentFile);

echo $parts[count($parts) - 1];

?>

 

but it keeps giving "index.php" instead of the actual filename(eg. s_01.php)....

 

Any suggestion? Thanx in advance guys....

Link to comment
https://forums.phpfreaks.com/topic/158515-solved-true-filename-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.