Page 1 of 1

inner page loading

Posted: Fri Jul 02, 2004 6:42 pm
by John Cartwright

Code: Select all

<?
	
getpage($_GET["p"]);

		function getpage($page)
			{
				
// notice the $page00 its for security reasons so the user doesnt "guess" the filename

                        if ($page == "106")
				{
					$page = "home";
				}
				elseif ($page == "d6f"
				{
					$page = "roster";
				}
                                else
                                {
                                         $page = "home";
                                }
                                include $page."00.php";
		
				

				//if (empty($page))
					//{
					//$page = "home";
					//}
		
				//$page = $page.".php";
				//include $page;
                               
                                }

?>
Okay I'm trying to design a template for this clan which has the layout and depending on which variable is loaded... simple task.... but on my companies website of this gaming portal demo of this system we want it to be secure without having elseif isloaded load this page.. because it can get quite long..

i want to have something more or less like the commented version.. but is obviously not secure...

i was jus wondering what ways do you guys do it?

Posted: Fri Jul 02, 2004 6:54 pm
by feyd
something like this?

Code: Select all

<?php

function getPage($page)
{
  switch(strtolower($page))
  {
    case "d6f":
       $use = 'roster';
       break;

    case "106":
    default:
       $use = 'home';
       break;
  }

  $use .= '00.php';
  if(is_readable($use))
      include $use;
}

?>

Posted: Fri Jul 02, 2004 6:58 pm
by John Cartwright
No you misunderstand feyd :( , I want to get away from

if this

if that

because my links list is rather large...
Just wondering if anyone has other solutions on disguising the path...
while keeping the code short

( i know someone gonna say mod re-write but i can't )

thanks for the reply :)

Posted: Fri Jul 02, 2004 7:05 pm
by feyd
well.. if you have some form of encoding that short form, you can reverse it.. Alternately, you could "register" the short for in a database (flat-file or sql, whatever) and "resolve" it...

Posted: Fri Jul 02, 2004 7:15 pm
by John Cartwright
that jus gave me the idea of base64_encode and decode..
tahnks: )

Posted: Fri Jul 02, 2004 7:22 pm
by John Cartwright
hmmmmmmmmmm base64 decode seems to go really slow...

is it jus me or what

Posted: Fri Jul 02, 2004 7:24 pm
by feyd
shouldn't take long to run.. although it will almost always make more bytes than needed to encode a given string/bytestream... If you want short forms.. I'd go a database route to store what they are supposed to be..

Posted: Fri Jul 02, 2004 7:27 pm
by John Cartwright
i dont really understand what you mean

Posted: Fri Jul 02, 2004 8:19 pm
by feyd
for which part?

Posted: Fri Jul 02, 2004 11:29 pm
by John Cartwright
nvm feyd it was actually a piece of code on each page that was really slwoing down the site... not the base64 decryption... thanks for your help :)