Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 07-05-2003, 10:20 PM   #1 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
PHP question I believe

Hello guys,

I am making a website which has three pages to it currently http://sig11.zemos.net/ilya2 . It has a main.html, a about.html and a basic.html. The basic.html file is pretty much a template which has an IFRAME

Code:
<IFRAME border=0 name=main marginWidth=1 marginHeight=1 src="main.html" frameBorder=0  width="100%"  height=450>
This iframe links to the content of the page. I was wondering if there was a way so that I could have a generic basic.php file where upon the slected destination (about.html or main.html), it will load the page accordingly. This is a bit of a simple questions but my mind has been to absorbed in C lately to think PHP . If you dont understand what I mean, just say so.

Thank you for your time.


Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 07-06-2003, 12:46 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,709
redhead is on a distinguished road
basic.php
PHP Code:
<some html stuff on the top.>

<?php
/* just to make sure, the main will be loadet if $page isn't set */
if(!isset($page))
   
$page="main";
/* some selection of another page, say main: */
echo "<a href=\"$PHP_SELF?page=main\">main</a>";
echo 
"<IFRAME border=0 name=main
        marginWidth=1 marginHeight=1 src=\"$page.html\" 
        frameBorder=0  width=\"100%\"  height=450>"
;
?>
<some html stuff on the bottom >
That'll do what you want..
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 07-06-2003, 10:25 AM   #3 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
I figured it out last night after about ten minutes. I was so stupid

Code:
src= ' <?     $_GET['page']   ?>.php'
\

Then I can go http://sig11.zemos.net/index.html?page=main or what not....


Ok, I forgot about loading a default page

EDIT: Got the default page thing to work, to lazy to post how...


Thanks,


Ilya
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 07-08-2003, 08:08 PM   #4 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
..If you haven't already, $_GET['page'] needs to be scrubbed a bit before including a file..

eg:
Code:
$foo = $_GET['page'];
$foo = basename($foo);
Just to make sure nothing bad happens if someone submits the page var like: http://dom/?page=../../../path/to/something/juicy

-r
idx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Comes of Age sde Code Newbie News 0 04-14-2004 11:41 AM
I need to learn PHP Nitro PHP 9 06-28-2003 11:24 AM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM
PHP Command-Line Arguments? Antagony PHP 3 05-02-2003 12:26 PM
Question about a php prediction script(Great Site!) Geetazz PHP 15 06-12-2002 05:37 PM


All times are GMT -8. The time now is 07:12 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting