Jump to content

Navigating to pages


thecoofunka

Recommended Posts

Dear all,

 

I have encountered a problem in my index.php file. When visiting my website the pages opens with no problem but when I try to click on the sub-pages like HOME, ABOUT US, and CONTACT US. It gives me a server error. I have tried to point to the location of where these pages are located but still no results.

 

I am not to familiar with PHP. What can I do to fix this issue and be able to view all pages. Below is the code I am having trouble with as far as I know.

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/" class="a11bold<?php if($_GET['page']=="") echo "sel";?>">HOME</a></td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/about-us.php" class="a11bold<?php if($_GET['page']=="about-us") echo "sel";?>">ABOUT US</a></td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/services.php" class="a11bold<?php if($_GET['page']=="services") echo "sel";?>">SERVICES</td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/tools.php" class="a11bold<?php if($_GET['page']=="tools") echo "sel";?>">TOOLS</td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/contact-us.php" class="a11bold<?php if($_GET['page']=="contact-us") echo "sel";?>">CONTACT US</td>

 

-Alex

 

Link to comment
Share on other sites

Here is the requested information.

 

This is the server error.

 

Internal Server Error

 

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, webmaster@website.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

 

Here is more of the code.

 

<?php

 

session_start();

 

?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

 

<?php

 

require("include/main.inc.php");

 

?>

 

<head>

 

<meta name="robots" content="noarchive">

 

<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.2)">

 

<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.2)">

 

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

 

<title>#HIDDEN#</title>

 

<link href="sub-web/styles.css" rel="stylesheet" type="text/css">

 

</head>

 

<body>

 

<div align="center">

 

<table width="962px" cellpadding="0" cellspacing="0" style="background-color:#FFFFFF;">

 

<tr>

 

<td width="6px" rowspan="6" style="background-image:url(sub-web/images/bg-tbl-left.png);background-repeat:repeat-y;"></td>

 

<td width="950px" height="15px" style="background-image:url(sub-web/images/top-bar.png);background-repeat:repeat-x;"></td>

 

<td width="6px" rowspan="6" style="background-image:url(sub-web/images/bg-tbl-right.png);background-repeat:repeat-y;"></td>

 

</tr>

 

<tr>

 

<td height="140" valign="bottom" align="left" style="background-image:url(sub-web/images/top-gradient.png);background-repeat:repeat-x;">

 

<div align="left">

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

 

<tr>

 

<td width="27%" align="left"><img src="sub-web/images/logo.png" style="margin-left:20px;" border="0"></td>

 

<td width="73%" align="right" valign="bottom">

 

<table border="0" cellspacing="1" cellpadding="0" style="margin-left:1px;margin-right:1px;">

 

<tr>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/" class="a11bold<?php if($_GET['page']=="") echo "sel";?>">HOME</a></td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/about-us.php" class="a11bold<?php if($_GET['page']=="about-us") echo "sel";?>">ABOUT US</a></td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/services.php" class="a11bold<?php if($_GET['page']=="services") echo "sel";?>">SERVICES</td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/tools.php" class="a11bold<?php if($_GET['page']=="tools") echo "sel";?>">TOOLS</td>

 

<td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/contact-us.php" class="a11bold<?php if($_GET['page']=="contact-us") echo "sel";?>">CONTACT US</td>

 

</tr>

 

</table>

 

</td>

 

</tr>

 

</table>

 

</div>

 

</td>

 

</tr>

 

<tr>

 

<td height="1" valign="top" style="background-color:#A6B8C3;"></td>

 

</tr>

 

<tr>

 

<td valign="top">

 

<table border="0" cellpadding="1" cellspacing="0" width="100%">

 

<tr>

 

<td width="660px" valign="top">

 

<div align="center" style="margin-top:2px">

 

<table width="100%" border="0" cellpadding="0" cellspacing="0">

 

<tr><td align="center"><img src="sub-web/images/top-banner.png" border="0"></td></tr>

 

</table>

 

</div>

 

<div align="center" style="margin-top:3px; margin-left:1px;">

 

<?php

 

if (file_exists("pages/".$_GET['page'].".php")) include("pages/".$_GET['page'].".php");

 

else include("pages/home.php");

 

?>

 

</div>

 

</td>

 

<td width="1px" height="800px" style="background-image:url(sub-web/images/separator-vert.png);background-repeat:repeat-y;"></td>

 

<td width="280px" valign="top">

 

<table width="280px" border="0" cellpadding="0" cellspacing="0">

 

<tr>

 

<td height="28px" width="4px" style="background-image:url(sub-web/images/title-left.png);"></td>

 

<td height="28px" width="266px" style="background-image:url(sub-web/images/title-middle.png);background-repeat:repeat-x;" align="left"><font class="text11bold"> •  LATEST COMPANY NEWS</font></td>

 

<td height="28px" width="10px" style="background-image:url(sub-web/images/title-right.png);"></td>

 

</tr>

 

</table>

 

 

 

<table width="280px" border="0" cellpadding="0" cellspacing="0">

 

<tr>

 

<td height="500px"></td>

 

</tr>

 

</table>

 

 

 

<table width="280px" border="0" cellpadding="0" cellspacing="0">

 

<tr>

 

<td height="28px" width="4px" style="background-image:url(sub-web/images/title-left.png);"></td>

 

<td height="28px" width="266px" style="background-image:url(sub-web/images/title-middle.png);background-repeat:repeat-x;" align="left"><font class="text11bold" align="left"> •  CUSTOMER LOGIN</font></td>

 

<td height="28px" width="10px" style="background-image:url(sub-web/images/title-right.png);"></td>

 

</tr>

 

</table>

 

 

 

<table width="280px" border="0" cellpadding="0" cellspacing="0">

 

<tr>

 

<td height="150px"></td>

 

</tr>

 

</table>

 

 

 

<table width="100%" border="0" cellpadding="0" cellspacing="0">

 

<tr>

 

<td align="center"><img src="sub-web/images/advertise.png" border="0"></td>

 

</tr>

 

</table>

 

</td>

 

</tr>

 

</table>

 

 

 

</td>

 

</tr>

 

<tr>

 

<td height="33px" align="center" style="background-image:url(sub-web/images/bottom-bar.png);background-repeat:repeat-x;">

 

<a href="sub-web/pages/" class="bottom-menu">HOME</a>

 

<font class="bottom-menu-text">::</font>

 

<a href="sub-web/pages/about-us.php" class="bottom-menu">ABOUT US</a>

 

<font class="bottom-menu-text">::</font>

 

<a href="sub-web/pages/services.php" class="bottom-menu">SERVICES</a>

 

<font class="bottom-menu-text">::</font>

 

<a href="sub-web/pages/tools.php" class="bottom-menu">TOOLS</a>

 

<font class="bottom-menu-text">::</font>

 

<a href="sub-web/pages/contact-us.php" class="bottom-menu">CONTACT US</a>

 

</td>

 

</tr>

 

<tr>

 

<td height="35px" align="center"><font class="text11normal">Copyright © <?=date('Y')?> <a href="http://www.xxxHIDEN.com/" class="a11normal">HIDDEN</a>. All Rights Reserved.</font></td>

 

<div style="border:1px solid #ccc;padding:10px 0px 3px 0px;text-align:center;background-color:#FFFFFF;min-width:235px; margin: 5px 0 5px 0;">

 

<!--GOOGLE TRANSLATE MINI FLAGS-->

<div align="center" style="width:auto;">

 

<!-- Add English to Russian BETA -->

 

<a target="_blank" rel="nofollow" onclick="window.open('http://www.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en%7Cru&hl=en&ie=UTF8'); return false;" title="Google-Translate-English to Russian BETA "><img border="0" style="cursor:pointer; cursor:hand;" width="24" alt="Google-Translate-English to Russian BETA " src="http://growpa.bay.livefilestore.com/y1phf9HxXBCzVD3KIGCm2oTlvoTGwR_rWkgTRQ0_w-Nw_Oi9OYdzIMfJjhl1kvbven1Fo61xxKLF_6KM7w_BlDhCg/_russian_s.png" height="24" title="Google-Translate-English to Russian BETA "/></a>

 

<!-- END English to Russian BETA -->

 

<!-- Add English to Spanish -->

 

<a target="_blank" rel="nofollow" onclick="window.open('http://www.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en%7Ces&hl=en&ie=UTF8'); return false;" title="Google-Translate-English to Spanish "><img border="0" style="cursor:pointer; cursor:hand;" width="24" alt="Google-Translate-English to Spanish " src="http://growpa.bay.livefilestore.com/y1pS41oGyQtMRYc6yBTJoaovLHaCZOthp6qXfQxIau493uQ-BefJvBTkz5kliT5BfzKgxIZ8hYMuUXPjKEXio1Gow/_spanish_s.png" height="24" title="Google-Translate-English to Spanish "/></a>

 

<!-- END English to Spanish -->

 

</div>

 

 

</div>

 

</tr>

 

</table>

 

</div>

 

</body>

 

</html>

 

-Alex

Link to comment
Share on other sites

Karl,

 

Thank you. Below should be PHP tagged.

 

Here is more of the code.

 

<?php

session_start();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<?php

require("include/main.inc.php");

?>

<head>

<meta name="robots" content="noarchive">

<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.2)">

<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.2)">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>#HIDDEN#</title>

<link href="sub-web/styles.css" rel="stylesheet" type="text/css">

</head>

<body>

<div align="center">

<table width="962px" cellpadding="0" cellspacing="0" style="background-color:#FFFFFF;">

<tr>

   <td width="6px" rowspan="6" style="background-image:url(sub-web/images/bg-tbl-left.png);background-repeat:repeat-y;"></td>

   <td width="950px" height="15px" style="background-image:url(sub-web/images/top-bar.png);background-repeat:repeat-x;"></td>

   <td width="6px" rowspan="6" style="background-image:url(sub-web/images/bg-tbl-right.png);background-repeat:repeat-y;"></td>

</tr>

<tr>

   <td height="140" valign="bottom" align="left" style="background-image:url(sub-web/images/top-gradient.png);background-repeat:repeat-x;">

   <div align="left">

      <table width="100%" border="0" cellspacing="0" cellpadding="0">

      <tr>

         <td width="27%" align="left"><img src="sub-web/images/logo.png" style="margin-left:20px;" border="0"></td>

         <td width="73%" align="right" valign="bottom">

            <table border="0" cellspacing="1" cellpadding="0" style="margin-left:1px;margin-right:1px;">

            <tr>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/" class="a11bold<?php if($_GET['page']=="") echo "sel";?>">HOME</a></td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/about-us.php" class="a11bold<?php if($_GET['page']=="about-us") echo "sel";?>">ABOUT US</a></td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/services.php" class="a11bold<?php if($_GET['page']=="services") echo "sel";?>">SERVICES</td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/tools.php" class="a11bold<?php if($_GET['page']=="tools") echo "sel";?>">TOOLS</td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="sub-web/pages/contact-us.php" class="a11bold<?php if($_GET['page']=="contact-us") echo "sel";?>">CONTACT US</td>

            </tr>

            </table>

         </td>

      </tr>

      </table>

   </div>

   </td>

</tr>

<tr>

   <td height="1" valign="top" style="background-color:#A6B8C3;"></td>

</tr>

<tr>

   <td valign="top">

      <table border="0" cellpadding="1" cellspacing="0" width="100%">

      <tr>

         <td width="660px" valign="top">

            <div align="center" style="margin-top:2px">

            <table width="100%" border="0" cellpadding="0" cellspacing="0">

            <tr><td align="center"><img src="sub-web/images/top-banner.png" border="0"></td></tr>

            </table>

            </div>

            <div align="center" style="margin-top:3px; margin-left:1px;">

            <?php

            if (file_exists("pages/".$_GET['page'].".php")) include("pages/".$_GET['page'].".php");

            else include("pages/home.php");            

            ?>

            </div>

         </td>

         <td width="1px" height="800px" style="background-image:url(sub-web/images/separator-vert.png);background-repeat:repeat-y;"></td>

         <td width="280px" valign="top">

            <table width="280px" border="0" cellpadding="0" cellspacing="0">

            <tr>

               <td height="28px" width="4px" style="background-image:url(sub-web/images/title-left.png);"></td>

               <td height="28px" width="266px" style="background-image:url(sub-web/images/title-middle.png);background-repeat:repeat-x;" align="left"><font class="text11bold"> •  LATEST COMPANY NEWS</font></td>

               <td height="28px" width="10px" style="background-image:url(sub-web/images/title-right.png);"></td>

            </tr>

            </table>

            

            <table width="280px" border="0" cellpadding="0" cellspacing="0">

            <tr>

               <td height="500px"></td>

            </tr>

            </table>

            

            <table width="280px" border="0" cellpadding="0" cellspacing="0">

            <tr>

               <td height="28px" width="4px" style="background-image:url(sub-web/images/title-left.png);"></td>

               <td height="28px" width="266px" style="background-image:url(sub-web/images/title-middle.png);background-repeat:repeat-x;" align="left"><font class="text11bold" align="left"> •  CUSTOMER LOGIN</font></td>

               <td height="28px" width="10px" style="background-image:url(sub-web/images/title-right.png);"></td>

            </tr>

            </table>



            <table width="280px" border="0" cellpadding="0" cellspacing="0">

            <tr>

               <td height="150px"></td>

            </tr>

            </table>

            

            <table width="100%" border="0" cellpadding="0" cellspacing="0">

            <tr>

               <td align="center"><img src="sub-web/images/advertise.png" border="0"></td>

            </tr>

            </table>

         </td>

      </tr>

      </table>

   

   </td>

</tr>

<tr>

   <td height="33px" align="center" style="background-image:url(sub-web/images/bottom-bar.png);background-repeat:repeat-x;">

      <a href="sub-web/pages/" class="bottom-menu">HOME</a>

      <font class="bottom-menu-text">::</font>

      <a href="sub-web/pages/about-us.php" class="bottom-menu">ABOUT US</a>

      <font class="bottom-menu-text">::</font>

      <a href="sub-web/pages/services.php" class="bottom-menu">SERVICES</a>

      <font class="bottom-menu-text">::</font>

      <a href="sub-web/pages/tools.php" class="bottom-menu">TOOLS</a>

      <font class="bottom-menu-text">::</font>

      <a href="sub-web/pages/contact-us.php" class="bottom-menu">CONTACT US</a>

   </td>

</tr>

<tr>

   <td height="35px" align="center"><font class="text11normal">Copyright © <?=date('Y')?> <a href="http://www.xxxHIDEN.com/" class="a11normal">HIDDEN</a>. All Rights Reserved.</font></td>
   
<div style="border:1px solid #ccc;padding:10px 0px 3px 0px;text-align:center;background-color:#FFFFFF;min-width:235px; margin: 5px 0 5px 0;">

<!--GOOGLE TRANSLATE MINI FLAGS-->
<div align="center" style="width:auto;">

<!-- Add English to Russian BETA -->

<a target="_blank" rel="nofollow" onclick="window.open('http://www.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en%7Cru&hl=en&ie=UTF8'); return false;" title="Google-Translate-English to Russian BETA "><img border="0" style="cursor:pointer; cursor:hand;" width="24" alt="Google-Translate-English to Russian BETA " src="http://growpa.bay.livefilestore.com/y1phf9HxXBCzVD3KIGCm2oTlvoTGwR_rWkgTRQ0_w-Nw_Oi9OYdzIMfJjhl1kvbven1Fo61xxKLF_6KM7w_BlDhCg/_russian_s.png" height="24" title="Google-Translate-English to Russian BETA "/></a>

<!-- END English to Russian BETA -->

<!-- Add English to Spanish -->

<a target="_blank" rel="nofollow" onclick="window.open('http://www.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=en%7Ces&hl=en&ie=UTF8'); return false;" title="Google-Translate-English to Spanish "><img border="0" style="cursor:pointer; cursor:hand;" width="24" alt="Google-Translate-English to Spanish " src="http://growpa.bay.livefilestore.com/y1pS41oGyQtMRYc6yBTJoaovLHaCZOthp6qXfQxIau493uQ-BefJvBTkz5kliT5BfzKgxIZ8hYMuUXPjKEXio1Gow/_spanish_s.png" height="24" title="Google-Translate-English to Spanish "/></a>

<!-- END English to Spanish -->

</div>


</div>

</tr>

</table>

</div>

</body>

</html>

 

 

-Alex

Link to comment
Share on other sites

if (file_exists("pages/".$_GET['page'].".php")) include("pages/".$_GET['page'].".php");

 

Simply won't work in your case, as it expects to see, home.php?page=

 

page= will determine which file it should include (if it exists). At the moment you're coding will never work as $_GET['page'] will never exist. Unless you did:

 

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="home.php" class="a11bold<?php if($_GET['page']=="") echo "sel";?>">HOME</a></td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="home.php?page=about-us" class="a11bold<?php if($_GET['page']=="about-us") echo "sel";?>">ABOUT US</a></td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="home.php?page=services" class="a11bold<?php if($_GET['page']=="services") echo "sel";?>">SERVICES</td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="home.php?page=tools" class="a11bold<?php if($_GET['page']=="tools") echo "sel";?>">TOOLS</td>

               <td width="99px" height="36px" style="background-image:url(sub-web/images/tab-button.png);" align="center"><a href="home.php?page=contact-us" class="a11bold<?php if($_GET['page']=="contact-us") echo "sel";?>">CONTACT US</td>

 

That probably won't work, but it gives you the rough idea.

Link to comment
Share on other sites

It won't work because of how the GET method works.

 

if (file_exists("pages/".$_GET['page'].".php")) include("pages/".$_GET['page'].".php");

 

That $_GET['page'] is returning nothing, ever. That's why it shows the home.php. The GET looks for what page, equals. So, home.php?page=about-us

 

In that example, page equals about.us. Therefore include("pages/".$_GET['page'].".php");, would be the equivalent of include("pages/about-us.php");

 

But with the way your links are set out, there is no GET method being defined, so it will always be null.

Link to comment
Share on other sites

That server error isn't caused by your script. It's Apache, maybe the permissions on your file aren't correct? CHMOD them to 755.

It could be the permissions, however, a 500 error is given if there isn't another suitable error to be displayed. So it could in fact, be his script.

Link to comment
Share on other sites

Well. I have tried to change all permissions and still no result so I think it's the error in my code.

 

Karl, so get method will not work. How do I go about fixing this problem? As I know it has worked before until I have moved and changed some files. Someone else was taking care of the site until I took over. How do I get it to work properly?

 

My index.php is located in public_html/sub-web/index.php

 

all my other pages like ABOUT US is located in public_html/sub-web/pages/

 

-Alex

Link to comment
Share on other sites

-Karl- is right 100%.

 

If you don't want your links to look like "home.php?page=about-us".  Then you have 2 options.  Rebuild your pages, or make a .htaccess file, and use mod-rewrite.

 

 

.htaccess

RewriteEngine on

RewriteRule ^sub-web/pages/(.*).php$ sub-web/index.php?page=$1

 

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.