It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

frame site help!!

Moderator: Malcolm

frame site help!!

Postby josku_x on Wed Jun 08, 2005 8:13 pm

Hi! I need help with my PHP code, here it is:

--start of index.php--

<?php
$indexdir="/folder/"; //the folder where all sites are stored
$indexcat=".php"; //extension of all sites
$indexid = getenv("QUERY_STRING"); //request the string after index.php?
if ($indexid==""){$indexid = "start"; exit;} //set default page, if not mentioned, as "start"

$frameid = $indexdir.$indexid.$indexcat; //create the frame URL
?>

<HTML>
<HEAD>
</HEAD>
<BODY>
<p>Here is content of site</p><!-- //site content -->
<? include"$frameid";?> <!-- //include the frame as the variable $frameid -->
<BODY>
</HTML>

--end of index.php--

What I want to be fixed is, that when someone goes to that page by entering: http://www.somedomain.com/~user/index.php, the default frame(<? include"$frameid";?>) will be "start" wich actually should redirect to http://www.somedomain.com/~user/folder/start.php

in that line /folder/ is folder, start is the default page OR the string that comes after index.php? and .php is the extension variable.

This doesn't seem to work, so need advice :)

Also, don't get the wrong idea of what I want, I want that script working so, that the <? include"$frameid";?> "frame" will be changed if someone goes to the page and enters(for example) .../index.php?test, then it should change the frame to .../folder/test.php.. You understand? I'm no good at explaining what I want, but hope if someone can help :)
josku_x
 
Posts: 16
Joined: Wed Jun 08, 2005 7:47 pm

Postby webmaster on Thu Jun 09, 2005 11:05 am

Hi and welcome do DEVPPL.

I can't understand why you have the 'exit;' in the if-statement. That means that the script will end there.

I think this code will work:
Code: Select all
<?php
$indexdir="/folder/"; //the folder where all sites are stored
$indexcat=".php"; //extension of all sites
$indexid = getenv("QUERY_STRING"); //request the string after index.php?
if ($indexid==""){$indexid = "start"; } //set default page, if not mentioned, as "start"

$frameid = $indexdir.$indexid.$indexcat; //create the frame URL

header("Location: $frameid");
exit;
?>


Another way to do this is to use mod_rewrite. It requires Apache as webserver. Make a google search about it to se if it can help you.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby josku_x on Fri Jun 10, 2005 4:11 pm

thank you!
josku_x
 
Posts: 16
Joined: Wed Jun 08, 2005 7:47 pm


Who is online

Users browsing this forum: No registered users and 0 guests