What if your page has a (-) mark, like privacy-policy.php?
What if your page has a (-) mark, like privacy-policy.php?
Change this:
to:PHP Code:// make sure $page is a word only
if (preg_match('/^\w+$/',$_GET['page'])) {
// include page only if it exists
if (file_exists("$_GET[page].php")) include "$_GET[page].php";
}
I'll update the original post with that info.PHP Code:// make sure $page is a word only
if (preg_match('/^[\w-]+$/',$_GET['page'])) {
// include page only if it exists
if (file_exists("$_GET[page].php")) include "$_GET[page].php";
}
Thanks,
Jamie
PHP shopping cart software - Squirrelcart
Please rate or review us!![]()
Hotscripts ● PHP Resource Index
Thanks Jamie, works perfect.
I followed the steps here, but I'm getting a 404 error in the page... although it does display the content.
You can see it here: http://squirrelcart.buylube.com/contactus.php
Here's what in contactus.php
Here's what's in index.php (renamed store.php)Code:<?php if (!$_GET['page']) { $_GET['page'] = "contactus"; $Title = "Contact Us"; $Keywords = ""; $Description = ''; include "index.php"; return; } ?> <p><b><font face="Arial, Helvetica, sans-serif" size="3">Via Email:</font></b></p> <p><font face="Arial, Helvetica, sans-serif" size="2"> For information about products, and other sales related questions: <b>sales@buylube.com</b><br> For existing orders: <b>orders@buylube.com</b></p> <p><b><font face="Arial, Helvetica, sans-serif" size="3"> Via Mail:</font></b></p> <p><font face="Arial, Helvetica, sans-serif" size="2"> The LBGroup, LLC<br> PO Box 556<br> Chelmsford MA 01824</p>
Code:<?php include 'squirrelcart/pre_storefront.php' ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="title" content="<?php print $Title ?>"> <meta name="keywords" content="<?php print $Keywords ?>"> <meta name="description" content="<?php print $Description ?>"> <title><?php print $Title ?></title> <?php stylesheet("store.css") ?> <?php include $cart_isp_root.'/storefront_head.php' ?> </head> <body> <table width="95%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td class="logo_header"> <img src="<?php print $SC['dyn_root']."/".$SC['image_folder'] ?>/topbar_01.jpg" alt="BuyLube"> </td> <td class="logo_header"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">have fun, play safe.</td> </tr> </table> <div align="center"> <table width="770" border="0"> <tr> <td valign="top" style="padding-top: 3px;"> <?php // Left Navigation section show_nav("Left Navigation"); ?> </td> <td width="100%" valign="top"> <?php if ($SC['show_home_page']) { include "home.php"; } else { ?> <table width="100%" border="0"> <tr> <td style="padding-bottom: 3; padding-top: 0"> <?php include "$cart_isp_root/crumb_navigation.php" ?> </td> </tr> <tr> <td class="content"> <?php // Cart Content section include "$cart_isp_root/cart_content.php" ; // make sure $page is a word only if (preg_match('/^[\w-]+$/',$_GET['page'])) { // include page only if it exists if (file_exists("$_GET[page].php")) include "$_GET[page].php"; } ?> </td> </tr> </table> <?php } ?> <br /> </td> <td valign="top" style="padding-top: 3;"> <?php // Right Navigation section show_nav("Right Navigation"); ?> </td> </tr> </table> </div> <table border="0" width="95%" cellspacing="0" cellpadding="3" align="center"> <tr class="footer"> <td align="center" class="footer">Copyright © 2008 LBGroup, LLC.</td> </tr> <tr height="10" valign="middle" align="middle" class="footer"> <td><img src="<?php print $SC['dyn_root']."/".$SC['image_folder'] ?>/rainbow.gif"></td> </tr> <tr height="8" class="footer"> <td><img src="<?php print $SC['dyn_root']."/".$SC['image_folder'] ?>/spacer.gif" alt="" width="4" height="1"></td> </tr> <tr height="15" class="footer"> <td align="center" class="footer"><font size="1" face="Arial, Helvetica, sans-serif"><a href="http://internetsupervision.com" target="_blank" title="Web Server Monitoring - InternetSupervision.com">Web Server Monitoring by InternetSupervision.com</a></font></td> </tr> </table> <?php // This is a link back to Squirrelcart.com. You can change the appearance of the link on the Visual Settings page in the control panel // squirrelcart_link(); // This line must go directly before your closing body tag include $SC['cart_isp_root'].'/post_storefront.php'; ?> </body> </html>
I'm not sure but it seems like when I set mine up I had to add something in the fields:
Try putting something in these and maybe make sure you use regular quotes in the $Description. You could try that.Code:$Keywords = ""; $Description = '';
I updated as you suggested... same thing.
PHP Code:<?php
if (!$_GET['page']) {
$_GET['page'] = "contactus";
$Title = "Contact Us";
$Keywords = "Contact Us";
$Description = "Contact Us";
include "index.php";
return;
}
?>
I'm not an expert by a Loooooong shot but here's what I would check and try:
Make sure the beginning of the php code on the contact-us.php page is all the way to the top i.e. no space at all.
try putting a dash in contactus like contact-us.
Here's how I have mine:
Code:<?php if (!$_GET['page']) { $_GET['page'] = "contact-us"; $Title = "My Beloved Angels Conact Us Form & Information"; $Keywords = "contact us"; $Description = 'My Beloved Angels Conact Us Form & Information'; include "angels.php"; return; } ?>
Mine has been put through a php compression software so its all on one line. I mean if your using Note pad it would be the first thing!
Here's the code exactly like I have it in my store.php page:
Then my Contact Us link looks like this:Code:<td class="content"><?php include "$cart_isp_root/cart_content.php" ; if (preg_match('/^[\w-]+$/',$_GET['page'])) { if (file_exists("$_GET[page].php")) include "$_GET[page].php";} ?></td>
The contact-us.php page is right beside the store.php in the directory. Not in another folder.Code:<a href="<?=$SC['dyn_root']?>/contact-us.php">Contact Us</a>
Maybe this helps.
What is angels.php that you include in your contact-us.php file? Is that your renamed version of store.php? That's the only thing different I can see in your file vs. mine.
yes
turned out to be a bug, which Jamie fixed.
Details here: http://www.ldev.com/forums/showthread.php?t=5471
FYI - This thread has been updated for version 3.x.
Thanks,
Jamie
PHP shopping cart software - Squirrelcart
Please rate or review us!![]()
Hotscripts ● PHP Resource Index
I was wondering what the syntax would be, if the file were in a dir of its own - that wat the root does not get to cluttered with extra php files
( $_GET[page].php )
or would it be on the end of the string store.php?=( dir path )page somehow?
Sorry, hate to bring up OLD stuff...but I just moved my site (SC 2.6.3) to a new webserver that is running PHP 5.3.2. This functionality appears to be the only thing that has broken with the move. The rest of the site is working fine, up to and including completio f orders through credit card processing...but my static pages are all broken.
I'm getting a 500 Internal Server Error
If I take the following out of the top of the linked file below, it works fine (though it's not displayed in the store page, just by itself):
http://www.itpdiesel.com/documentation.phpCode:<?php if (!$_GET['page']) { $_GET['page'] = "documentation"; $Title = "Documentation"; $Keywords = "Documentation"; $Description = 'Documentation'; include "store.php"; return; } ?>
EVERY single one of my static pages with this code at the top fails with the same 500 error...I'm at a loss...
I ran into several deprecated functions with the upgrade to PHP 5.3+, could this have something to do with a function that has been altered or deprecated?
BTW, yes, I know my version is old. I'm working on an upgrade to 3.x but since I can't just upgrade due to the significant changes to the style system...It's taking longer than expected. I just need to "bandaid" this functionality temporarily until I get moved to 3.x.
Thanks!
Last edited by ITPDiesel; April 4th, 2010 at 06:46 PM. Reason: Additional Information
No quick fix ideas???
OK, just found that the Rates and Services function from the control panel is also returning an error 500...since this is the only other thing I've found so far after this upgrade...thinking they are related. Please help!
There are currently 1 users browsing this thread. (0 members and 1 guests)