Jump to content

...a Way To Get There


boxturt
 Share

Recommended Posts

This has me stumped for many days. I'm pretty sure I've seen this but I don't remember where and I can't seem to get my head around it enough to figure it out.

 

I would like to offer specific visitors the ability upon arriving at the site, enter a specific filename in a form field, click go and be taken straight there to that specific file. eg: go to

 

h**p://****/some_folder/specificfile.html

 

but all the visitor would type in is 'specificfile'

 

I probably haven't posed this query very well and I apologize. Any hints would be greatly appreciated.

 

Thank you

Link to comment
Share on other sites

Something like;

 

><form method=post>
Keyword: <br>
<input type=text name=keyword>
<input type=hidden name=sub value=1>
<input type=submit value=Go!>
<?php 
if($sub==1)
{
if($keyword=="keyword1")
{
echo("<script>window.location='url_for_keyword1';</script>");
}
else if($keyword=="keyword2")
{
echo("<script>window.location='url_for_keyword2';</script>");
}
else if($keyword=="keyword3")
{
echo("<script>window.location='url_for_keyword3';</script>");
}
else
{
echo("That is not a valid keyword.");
}
}
?>

 

Might work.

 

Still looking, I found this at the sitepoint forums.

Link to comment
Share on other sites

Thanks Rob, I appreciate it. Pretty neat, works well but might get weird for content that's always getting added/changed/removed. I almost think I need some sort of modified site search that delivers the page on demand.

 

I dunno.

 

Clueless As Usual In Naugahyde.......

Link to comment
Share on other sites

Here's what I would use... It would need to be modified to work for extensions other than HTML:

 

><form method=post>
Keyword: <br>
<input type=text name=filename>
<input type=hidden name=sub value=1>
<input type=submit value=Go!>
<?php 
if($sub==1)
{
if(file_exists("/home/yourcpaneluser/public_html/somefolder/" . $filename . ".html"))
{
 header("Location: /somefolder/" . $filename . ".html");
}
else
{
 echo "The file, it does not exist! Run around and scream!";
}
}
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...