Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

i require a php code to do this?

i want a php code to achieve the following

1. lets say a request for www.mysite.com/index.php?p=prince

2. index.php recieves the value "prince"

3. it checks in directory "/" if any filename "prince.php" exists,

4a. if yes, it redirects to the file "prince.php"

4b. else it creates the file with the name "prince.php" and redirects to it

thanks

1 Answer

Relevance
  • 10 years ago

    Simpola...

    $thevalue = filter_input(INPUT_GET, "p");

    if (file_exists($thevalue.".php") ) OR file_exists("/mydir/".$thevalue.".php")

    {

    print "<script>LOOK FOR JAVASCRIPT REDIRECT. I forgot it don't don't feel like logging into my server</script>";

    }

    else {print "File ".$thevalue.".php does not exist.";};\

    we, we, voule' :)

    Source(s): valevarkasystems.com
Still have questions? Get your answers by asking now.