web page programming advice needed

dbarton

Senior member
Apr 11, 2002
767
0
76
some web page programming advice needed, please.

I have a page with a menu for navigation.
example at http://skylab2000.com/test/main9.htm

In order to have the left navigation menu stay on each page I could use frames, but people seem to not like em? not sure why.
I could just duplicate the code on each page, but kinda sloppy.

Any idea what to use to have that menu on each page? shtml? asp? php? cfm?
any code on a page I can have look at?



 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
You can do an include inside .shtml pages that are otherwise just "normal" HTML

... your html ...

< !--#include virtual="/includes/menu.htm"-- >

...more html ...

That can be easier that using php, perl etc. which must include code to generate / print HTML instead of you just typing it in like with an .htm page.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: DaveSimmons
You can do an include inside .shtml pages that are otherwise just "normal" HTML

... your html ...

< !--#include virtual="/includes/menu.htm"-- >

...more html ...

That can be easier that using php, perl etc. which must include code to generate / print HTML instead of you just typing it in like with an .htm page.


Not all the time, you could do like the following.

 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Ah, makes sense. I've worked with PHP exactly once, to fix a bug in a contractor's script. When I do something on a server it's usually in Perl, but 99% of my time is spent on Windows C++ coding so I'm no expert there either.
 

bofkentucky

Member
Nov 8, 2004
28
0
0
Server side includes are turned off (for good reason) with a lot of web hosts, php is much more likely to be operational for this sort of work.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Just out of curiosity, why is there good reason to turn off ssi but allow php?
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: lilcam
Search google for "server side include vulnerability" and you'll know.

The vulnerablities exist because the scripter/programmer does not include any kind of data verification into the scripts.

For example, say I have an index page which can take a parameter either through post or get that is the name of a file to include. Let's use ASP for example

http://mysite.com/index.asp?inc=test.asp

if my asp code was the following,
<%
if Request("inc") = "test.asp" then %> <!-- #include file="test.asp" --> <% end if %>

Then no matter what people tried to put as a value for inc, it would only include files that i specified, and that is only test.asp.

One of the most important things to remember as a programmer is to NEVER trust the user to give you valid input. Always check the input to make sure it is valid before using it in any way shape or form.

 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81
Originally posted by: MCrusty
Originally posted by: lilcam
Search google for "server side include vulnerability" and you'll know.

The vulnerablities exist because the scripter/programmer does not include any kind of data verification into the scripts.

For example, say I have an index page which can take a parameter either through post or get that is the name of a file to include. Let's use ASP for example

http://mysite.com/index.asp?inc=test.asp

if my asp code was the following,
<%
if Request("inc") = "test.asp" then %> <!-- #include file="test.asp" --> <% end if %>

Then no matter what people tried to put as a value for inc, it would only include files that i specified, and that is only test.asp.

One of the most important things to remember as a programmer is to NEVER trust the user to give you valid input. Always check the input to make sure it is valid before using it in any way shape or form.

^ what he said

 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
I did some googling and so far I haven't noticed anything that isn't either a bug in IIS (or Apache) or that couldn't be done the same using php. I mean in the example you gave, MCrusty, if the programmer was dumb enough to put Request("inc") straight into the ssi he/she could easily do the same thing with a php include() right? Or is it that ssi processors run with a higher permission level than php?
 

NikPreviousAcct

No Lifer
Aug 15, 2000
52,763
1
0
Make a "config.php" file with these contents:

<?php

$header = "/var/www/html/header.html";
$menu = "/var/www/html/menu.html";

?>

Then edit index.php, page1.php, page2.php and the rest of the pages and add this code at the beginning:

<?php
require_once($header);
require_once($menu);
?>
<html>
blah blah blah your page blah blah blah whatever blah
</html>

Then you just open header.php and menu.php and make whatever kind of banner (header.php) for your site and create the menu (menu.php).

What this does is assign specific pages to a variables. You tell the webserver what variables exist and what static pages those variables refer to (config.php). Each time you type "require_once("/var/www/html/config.php");" the webserver will load those variables into memory so it knows where to look if you call those variables.

Then, in your individual website pages, typing "require_once($header);" will call copy whatever code is in that file that's assigned to the $header variable and paste it into the file, right where you called it.

As an example, let's say you have this for your header.php file:
<html>
<center>
<img src="website_banner_picture.jpg">
</center>
</html>

Let's also say that you have this for your menu.php file:
<html>
<a href="page1.php">Page 1</a>
<a href="page2.php">Page 2</a>
<a href="page3.php">Page 3</a>
</html>

Let's also say that you have this in your index.php file:
<?php
require_once($header);
require_once($menu);
?>
<html>
Hello World
</html>

When someone goes to your domain, they're going to see a page much larger than just those few lines of code in your index file because it's pulling all the code from those $header and $menu files. They'll see this code:

<html>
<center>
<img src="website_banner_picture.jpg">
</center>
</html>
<html>
<a href="page1.php">Page 1</a>
<a href="page2.php">Page 2</a>
<a href="page3.php">Page 3</a>
</html>
<html>
Hello World
</html>

Make sense? With some creativity and tables, you can create quite the complicated website with just a few lines of code instead of hard-coding each individual page. You just have to include that first bit in each file, which you don't even have to change at all later if you want to change the content of the menu or the header or whatever other kinds of pages that you want to have included all in one page. You just edit those header.php, menu.php, footer.php, or whatever and because it's all dynamically called, all of your pages get updated.

Let your creativity take this and run with it. It's a very simple idea once understood and very powerful.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |