Problem with "dynamic" index page


Posted on 16th Feb 2014 07:03 pm by admin

Hi. I have one question. In my index.php page I have this kind of code:
Code: // listaa sivut
$pages = Array (
"etusivu" => "etusivu.php",,
"linkit" => "linkit.php",
"yhteydet" => "yhteydet.php",
"tiedotteet" => "tiedote.php",
"uutiset" => "uutiset.php",
"tapahtumat" => "tapahtumat.php",
);
// Jos sivua ei loydy, naytetaan etusivu
$page = ($_GET["page"] != "") ? $_GET["page"] : "etusivu";
if (isset($pages[$page]) AND file_exists($pages[$page])) {
include ($pages[$page]);
} else {
// Jotakin vaarin! naytetaan 404-viesti
echo "Virhe 404 - Sivua ei löydy!";
}
function MakeArray ($dir) {
global $pages;
$handle = OpenDir ($dir) or die ("Couldn't open $handle!");
while (FALSE !== ($file = ReadDir($handle))) {
if ($file != ".." AND $file != ".") {
if (is_dir($dir . $file)) {
MakeArray ($dir . $file . "/");
} else {
$pages[ereg_replace(".(.*)$", "", $file)] = $dir . $file;
}
}
}

CloseDir ($handle);
}
?>
Ewerything else works ok, but I want put in $pages array page tapahtumat&page=2. How to do it?

I mean that this addres works in index php:
www.mydomain.com/index.php?page=tapahtumat

This addres does not work:
www.mydomain.com/index.php?page=tapahtumat&page=2

What I have to do?

No comments posted yet

Your Answer:

Login to answer
195 Like 47 Dislike
Previous forums Next forums
Other forums

Help please - How to validate from 2 possible answers
Hi

I hope somebody can help me with what will probably be really simple, I'm pulling my hair

Transport data between itab and textfield on ALV event
Hallo,

I have a ALV Grid ( cl_gui_alv_grid ) and I also have hotspot click event with a h

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.

However

MFC GUI Programming
I am working on a project right now that requires me to create a MFC Windows GUI. Basically it need

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

Prevention Help
How can I use PHP or any other language (feel free to move this thread) to prevent users doing scree

Problems with strings containing
Hey all,

I have encountered something strange in a script. I am trying to write an XML heade

CURL question
i am wondering if it's possible to use multi curl with login something like

login once to web

writing my own sobel filter convolution - something is wrong
I am trying to keep it very simple, I cant see anything wrong with my logic, could anybody help poin

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash