Jump to content

Dynamic Page Conflicting!


Franjdea

Recommended Posts

Hey,

 

I'm trying to make a dynamic php website. So far it's been working fine. All my pages are in a page folder and with my code I'm able to access it via "index.php?page=nameofphpfile" etc. Now I added a page under there with a similar code to the index and it is conflicting.

 

This is the code for the index.php

	$page=$_GET['page'];
if ($page)
{
	include("pages/".$page.".php");
}
else
{
	echo "This Page Does Not Exist.";
}
}

 

On my skin.php page when I try to put a GET variable in, I get the word THIS PAGE DOES NOT EXIST.

 

I'm really stuck and need help, I know it's brief so please help me out here!

 

-Francis

Link to comment
Share on other sites

The code above is the only important part of the index.php

 

Here is my file inside the page folder, well the important part anyway!

function ShowPage($pageid) // Show page $pageid
{
global $pagecont;
global $pagemax;

if (isset($pagecont[$pageid][0])) $s1 = $pagecont[$pageid][0]; else $s1 = -1; // Assign all skins of our page to a var
if (isset($pagecont[$pageid][1])) $s2 = $pagecont[$pageid][1]; else $s2 = -1;
if (isset($pagecont[$pageid][2])) $s3 = $pagecont[$pageid][2]; else $s3 = -1;
if (isset($pagecont[$pageid][3])) $s4 = $pagecont[$pageid][3]; else $s4 = -1;
if (isset($pagecont[$pageid][4])) $s5 = $pagecont[$pageid][4]; else $s5 = -1;
if (isset($pagecont[$pageid][5])) $s6 = $pagecont[$pageid][5]; else $s6 = -1;
if (isset($pagecont[$pageid][6])) $s7 = $pagecont[$pageid][6]; else $s7 = -1;
if (isset($pagecont[$pageid][7])) $s8 = $pagecont[$pageid][7]; else $s8 = -1;
if (isset($pagecont[$pageid][8])) $s9 = $pagecont[$pageid][8]; else $s9 = -1;
if (isset($pagecont[$pageid][9])) $s10 = $pagecont[$pageid][9]; else $s10 = -1;
if (isset($pagecont[$pageid][10])) $s11 = $pagecont[$pageid][10]; else $s11 = -1;
if (isset($pagecont[$pageid][11])) $s12 = $pagecont[$pageid][11]; else $s12 = -1;
if (isset($pagecont[$pageid][12])) $s13 = $pagecont[$pageid][12]; else $s13 = -1;
if (isset($pagecont[$pageid][13])) $s14 = $pagecont[$pageid][13]; else $s14 = -1;
if (isset($pagecont[$pageid][14])) $s15 = $pagecont[$pageid][14]; else $s15 = -1;
if (isset($pagecont[$pageid][15])) $s16 = $pagecont[$pageid][15]; else $s16 = -1;

echo "<center><table>";

echo "<tr><td><a href=\"index.php?verifyskin=$s1\"><img src=images/skins/$s1.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s2\"><img src=images/skins/$s2.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s3\"><img src=images/skins/$s3.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s4\"><img src=images/skins/$s4.png></a></td></tr>";

echo "<tr><td><a href=\"index.php?verifyskin=$s5\"><img src=images/skins/$s5.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s6\"><img src=images/skins/$s6.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s7\"><img src=images/skins/$s7.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s8\"><img src=images/skins/$s8.png></a></td></tr>";

echo "<tr><td><a href=\"index.php?verifyskin=$s9\"><img src=images/skins/$s9.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s10\"><img src=images/skins/$s10.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s11\"><img src=images/skins/$s11.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s12\"><img src=images/skins/$s12.png></a></td></tr>";

echo "<tr><td><a href=\"index.php?verifyskin=$s13\"><img src=images/skins/$s13.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s14\"><img src=images/skins/$s14.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s15\"><img src=images/skins/$s15.png></a></td>";
echo "<td><a href=\"index.php?verifyskin=$s16\"><img src=images/skins/$s16.png></a></td></tr>";

echo "</table></center>";
}
?>

 

Then to get the ?skinpage=

 

if(isset($_GET["skinpage"]) && $_GET["skinpage"] <= $maxpage && $_GET["skinpage"] >= 0) // Check if the referenced page was valid, else goto page 1
{
ShowPage($_GET["skinpage"]);
}
else
{
ShowPage(0);
}

 

Does that help you any further? :)

 

Thanks!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.