2013-12-15 73 views
-1

我工作的非营利组织正试图从我们定价过高的主机转移到为非盈利组织提供免费托管的主机。我的网页知识很老,并且对html很有限 - 没有PHP知识。我们当前的主机为用户提供了自定义界面,并且不允许我们在public_html文件夹中查看文件或下载它们。index.php?s =不会加载其他内容

根据他们的技术支持,这是不可能与他们的平台。我已经能够在新主机站点上重新创建大部分内容,但无法重新创建index.php文件。使用PHP教程我创建了一个新的教程,但它不会加载除欢迎页面以外的任何内容,我不确定在代码中我做了什么错误。

我的菜单项是这样的:

<li class="on"> 
    <a href="http://ourcharity/index.php?s=8077" target="_self"class="on">Welcome</a> 
</li> 

和我的index.php代码:

<?php 
// create an array with data for title, and meta, for each page 
$pgdata = array(); 
$pgdata['8077'] = array(
    'title'=>'WELCOME', 
    'description'=>'', 
    'keywords'=>'self-sufficiency' 
); 
$pgdata['8065'] = array(
    'title'=>'About Us', 
    'description'=>'', 
    'keywords'=>'self-sufficiency' 
); 

// set the page name 
$pgname = isset($_GET['pg']) ? trim(strip_tags($_GET['pg'])) : '8077'; 

// get title, and meta data for current /accessed page 
$title = $pgdata[$pgname]['title']; 
$description = $pgdata[$pgname]['description']; 
$keywords = $pgdata[$pgname]['keywords']; 

// set header for utf-8 encode 
header('Content-type: text/html; charset=utf-8'); 
?> 
<!doctype html> 
<html> 
<head> 
    <!-- begin spin_special_output(head_start) --> 

    <style type="text/css"> 
    .wd_featurebox_icon { 
     display: inline; 
    } 
    .wd_featurebox_icon img { 
     vertical-align: middle; 
    } 
    div.wd_featurebox_group div.wd_tabs_wrapper { 
     border: none; 
     border-bottom: 1px solid #E1E1E1; 
     padding: 0 0 5px 0; 
    } 
    div.wd_featurebox_group div.wd_featurebox { 
     border: none; 
     padding: 8px 0 0 0; 
    } 
    div.wd_featurebox_group li.wd_tab { 
     float: none; 
     color: #666666; 
    } 
    div.wd_featurebox_group li.wd_tab-active { 
     border: none; 
     background-color: transparent; 
     color: #000000; 
     font-weight: bold; 
    } 
    div.wd_featurebox_group li.wd_tab-inactive { 
     cursor: auto; 
    } 
    </style> 
    <script type="text/javascript"> 
    function view_printable() { 
     var loc = window.location; 
     var sep = (loc.search == "") ? "?" : "&"; 
     var url = loc.protocol+"//"+loc.host+loc.pathname+loc.search+sep+"printable"+loc.hash; 
     window.open(url, "_blank", ""); 
    } 
    </script> 
    <style type="text/css"> 
    span.wd_page_tool {display: inline-block; margin: 0px; padding: 0px; vertical-align: middle;} 
    div.wd_page_toolbar td span.wd_page_tool {margin: 2px;} 
    div.wd_page_toolbar td {text-align: center;} 
    span.wd_page_tool a {display: inline-block; height: 16px; margin: 0px; padding: 0px; vertical-align: middle;} 
    span.wd_page_tool a span {display: inline-block; margin: 0px; padding: 0px; vertical-align: middle;} 
    </style> 

    <!-- end spin_special_output(head_start) --> 
    <meta charset="utf-8" /> 
    <title><?php echo $title; ?></title> 
    <meta name="description" content="<?php echo $description; ?>" /> 
    <meta name="keywords" content="<?php echo $keywords; ?>" /> 
    <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> 

    <link rel="stylesheet" type="text/css" href="css/style.css" /> 
    <link rel="stylesheet" type="text/css" href="css/wdcontent.css" /> 
    <link rel="image_src" href="images/facebook_logo.jpg" /> 
</head> 
<body> 
<div id="headerwrapper" align="center"> 

    <div id="header"> 
    <div id="headerleft"> 
     <div id="headerright"> 

     <div id="logo"><img src="images/logo.jpg" alt="" border="0" /></div> 

     <div id="headerinner"> 

      <div id="topnav"> 
      <ul> 
       <li><a href="index.php?s=8088" target="_self">Contact Us</a></li> 
      </ul> 
      </div> 

      <div id="tagbanner"> 

      <img src="file.php/70929/banner.jpg" border="0" /> 
      <div id="tagline"> 
       Self-Sufficiency 
       <h2></h2><p> </p>   </div> 

      </div> 

     </div> 

     <div id="search" align="right"> 
      <div id="searchform"> 
      <!-- BEGIN T1 SEARCH --> 
      <form method="post" action="index.php?s=8092"> 
       <input class="input" size="15" name="query" value="" /> 
       <input type="submit" class="submit" value="Search" /> 
      </form> 
      <!-- END T1 SEARCH --> 
      </div> 
     </div> 

     </div><!-- END HEADERRIGHT --> 
    </div><!-- END HEADERWRAPPERINNERLEFT --> 
    </div><!-- END HEADER --> 

</div><!-- END HEADERWRAPPER --> 


<?php echo file_get_contents(''. $pgname. '.htm'); ?> 


</body> 
</html> 
+2

如何使用'$ _GET ['s']'而不是'$ _GET ['pg']'? (在16行上是2) – MiniGod

+0

这是问题所在。非常感谢你!我已经浏览了很多小时的代码,并没有进行关联,但现在它变得非常有意义。 – user3103472

+0

如果你想让你的数据发送出现在链接中,只需使用GET表单类型 – Anas

回答

0

使用$_GET['s']而不是$_GET['pg']。 (2x在线16)